This pop-up window is the display popup for the boot Systemui:
First, in the Systemui source directory to add source class files, directory is frameworks/base/packages/systemui/src/com/android/systemui/settings, Class name tentatively taken as Updateui.java
The contents are as follows:
/*
* Copyright (C) The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* You are not a use this file except in compliance with the License.
* Obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable or agreed to writing, software
* Distributed under the License is distributed on a "as is" BASIS,
* Without warranties or CONDITIONS of any KIND, either express or implied.
* See the License for the specific language governing permissions and
* Limitations under the License.
*/
Package com.android.systemui.settings;
Import Android.app.ActivityManager;
Import Android.app.ActivityManager.RunningTaskInfo;
Import Android.app.AlertDialog;
Import Android.app.Dialog;
Import Android.app.HeimiDialog;
Import Android.content.BroadcastReceiver;
Import Android.content.ComponentName;
Import Android.content.ContentResolver;
Import android.content.SharedPreferences;
Import Android.content.SharedPreferences.Editor;
Import Android.content.Context;
Import Android.content.DialogInterface;
Import Android.content.DialogInterface.OnDismissListener;
Import android.content.Intent;
Import Android.content.IntentFilter;
Import Android.net.Uri;
Import Android.os.UserHandle;
Import android.provider.Settings;
Import Android.util.Slog;
Import Android.view.View;
Import android.view.MotionEvent;
Import Android.view.WindowManager;
Import Android.widget.Button;
Import Android.widget.TextView;
Import COM.ANDROID.SYSTEMUI.R;
Import Com.android.systemui.SystemUI;
Import Android.app.HeimiDialog.ButtonClickListener;
Import Java.io.FileDescriptor;
Import Java.io.PrintWriter;
Import Java.util.Arrays;
Import java.util.List;
public class UpdateUI extends Systemui {
Static final String TAG = "UpdateUI";
Static final String ACTION = "Android.hm.WITH_UPGRADE_ICON";
Static final String Sourceflag = "From_check_service";
Static final String Forceflag = "Force";
Static final String Update = "com.heimi.ota.MainActivity";
private static Boolean Fromservice = False;private static Boolean forceupdate = False;private String vers;private SHAREDPR Eferences sp; Heimidialog Mupdatedialog; TextView mupdatetextview;private Long mscreenofftime = -1;public void Start () {//Register for Intent broadcasts for: . Intentfilter filter = new Intentfilter (); Filter.addaction (ACTION); Mcontext.registerreceiver (mintentreceiver, filter, NULL, NULL);} Private Boolean shouldshow (Final String str) {//here implements the storage of the data, and if it is the same cue data, the popup will no longer pop up, and each data field obtained from the broadcast is compared to the data in the saved file. SP = mcontext.getsharedpreferences ("version", context.mode_private); String Version = sp.getstring ("Version", ""); if (!str.equals (version)) {Editor ed = Sp.edit (); Ed.putstring ("version", Vers); Ed.commit (); return true; } return false;} Private Boolean Gettopwindow () {Activitymanager am = (activitymanager) (Mcontext). Getsystemservice (context.activity_ SERVICE); ComponentName cn = Am.getrunningtasks (1). Get (0). Topactivity; SLOG.E (TAG, "activity:" + cn.getclassname (). toString ()); if (Cn.getclassname (). Contains (Update)) return true; return false;} Private Broadcastreceiver Mintentreceiver = new Broadcastreceiver () {@Override public void onreceive (Context contex T, Intent Intent) {String action = intent.getaction (); if (Action.equals (action)) {Fromservice = Intent.getbooleanextra (Sourceflag, false); ForceUpdate = Intent.getbooleanextra (Forceflag, false); Vers = Intent.getstringextra ("version"); if (Fromservice &&!gettopwindow ()) {if (forceupdate) {Showupdatedialog (Forceu Pdate); Return } else if (Shouldshow (vers)) {showupdatedialog (forceupdate); Return }}}}};void Dismissupdatedialog () {if (Mupdatedialog! = null) {Mupdatedialog.dismiss (); MupdateDialog = null; }}void Showupdatedialog (Final boolean bool) {SLOG.E (TAG, "= = = Show update Dialog = = = = = = = = ="); This dialog is a standard dialog, which is included in the opening android.app.HeimiDialog heimidialog.builder B = new Heimidialog.builder (mcontext); Heimidialog dialog = B.create (); Dialog.setrightbuttonname (mcontext.getstring (r.string.sure)); Dialog.setleftbuttonname (mcontext.getstring (r.string.cancel)); Dialog.setcontent (mcontext.getstring (R.string.update_notice)); Dialog.settitle (mcontext.getstring (r.string.system_update)); Dialog.notcloseontouch (); if (bool) {dialog.setleftbuttonvisible (false); Dialog.setmiddlelinevisible (FALSE); } final Intent Intent = new Intent (); ComponentName comp = new ComponentName ("Com.heimi.ota", "com.heimi.ota.MainActivity"); Intent.setcomponent (comp); Intent.setaction ("Android.intent.action.VIEW"); Intent.setflags (Intent.flag_activity_new_task); if (Intent.resolveactivity (Mcontext.getpackagemanager ())! = NULL{Dialog.setclicklistener (new Buttonclicklistener () {@Override public void RightClick () { Mcontext.startactivityasuser (Intent, userhandle.current); Dismissupdatedialog (); } @Override public void Leftclick () {if (!bool) dismissupdatedial OG (); } }); } Dialog.getwindow (). SetType (WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); Dialog.getwindow (). GetAttributes (). Privateflags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS; Dialog.show (); mupdatedialog = Dialog;}
}
The class is then added to the list of service classes that start up in Systemui, and the directory is frameworks/base/packages/systemui/src/com/android/systemui/ Systemuiservice.java
Private Final Class
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android4.4 systemui Add Cue Popup