.. | .. |
---|
| 1 | +
|
---|
| 2 | +package com.android.systemui;
|
---|
| 3 | +
|
---|
| 4 | +import android.app.NotificationManager;
|
---|
| 5 | +import android.content.BroadcastReceiver;
|
---|
| 6 | +import android.content.Context;
|
---|
| 7 | +import android.content.Intent;
|
---|
| 8 | +import android.os.Process;
|
---|
| 9 | +import android.os.SystemProperties;
|
---|
| 10 | +import android.util.Log;
|
---|
| 11 | +import android.content.ComponentName;
|
---|
| 12 | +
|
---|
| 13 | +import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
---|
| 14 | +
|
---|
| 15 | +public class BootonAppReceiver extends BroadcastReceiver {
|
---|
| 16 | +
|
---|
| 17 | + static void LauncherbootApp(Context context) {
|
---|
| 18 | + try {
|
---|
| 19 | + Intent myintent = new Intent(Intent.ACTION_MAIN);
|
---|
| 20 | + String bootAppPack = "null";
|
---|
| 21 | + String bootAppClass = "null";
|
---|
| 22 | +
|
---|
| 23 | + if ("1".equals(SystemProperties.get("persist.sys.bootonDeviceTest", "0"))) {
|
---|
| 24 | + bootAppPack = "com.DeviceTest";
|
---|
| 25 | + bootAppClass = "com.DeviceTest.DeviceTest";
|
---|
| 26 | + SystemProperties.set("persist.sys.bootonDeviceTest", "0");
|
---|
| 27 | + } else {
|
---|
| 28 | + bootAppPack = SystemProperties.get("persist.sys.bootAppPack", "null");
|
---|
| 29 | + bootAppClass = SystemProperties.get("persist.sys.bootAppClass", "null");
|
---|
| 30 | + }
|
---|
| 31 | + Log.i("kickpi","will boot up APP - " + bootAppPack + "/" + bootAppClass);
|
---|
| 32 | +
|
---|
| 33 | + ComponentName cn = new ComponentName(bootAppPack, bootAppClass);
|
---|
| 34 | + myintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
---|
| 35 | + myintent.setComponent(cn);
|
---|
| 36 | + context.startActivity(myintent);
|
---|
| 37 | + } catch (Exception e) {
|
---|
| 38 | + e.printStackTrace();
|
---|
| 39 | + }
|
---|
| 40 | + }
|
---|
| 41 | +
|
---|
| 42 | + @Override
|
---|
| 43 | + public void onReceive(Context context, Intent intent) {
|
---|
| 44 | + if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
|
---|
| 45 | + LauncherbootApp(context);
|
---|
| 46 | + }
|
---|
| 47 | + }
|
---|
| 48 | +}
|
---|