hjw
2022-12-15 14ad445292a8147ca88fb3355b71a85253fe7556
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
package com.jwipc.nodka_reboot_under;
 
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
 
import com.jwipc.nodka_reboot_under.utils.Utils;
 
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.hardware.spirit.AlarmPowerManager;
import android.os.PowerManager;
import android.util.Log;
 
 
 
public class BroadcastReceiver_Boot extends BroadcastReceiver{
 
   
   
   Utils mUtils;
   
   
   
   
   
   @Override
   public void onReceive(final Context context, Intent intent) {
       // TODO Auto-generated method stub
               
       mUtils = new Utils(context);
       
       String action = intent.getAction();
       
       if(action.equals("android.intent.action.BOOT_COMPLETED"))
       {
           mUtils.thread_AlarmPower_Repeat_Poweroff();
           
           if(!mUtils.get_time_reboot_isdone() || mUtils.get_time_reboot_isRepeat())
               mUtils.set_time_reboot_by_xml();
           
           if(!mUtils.isServiceRunning(context, The_Service.class.getName()))
           {
               context.startService(new Intent(context, The_Service.class));
           }
           
           
           String is_repeat = mUtils.get_String_From_SharedPreferences(mUtils.set_time_reboot_repeat);
           if(!is_repeat.equals("true"))
           {
               
               AlarmPowerManager mAlarmPowerManager = new AlarmPowerManager();
               mAlarmPowerManager.removeAllalarmPower();
               
               mUtils.remove_String_From_SharedPreferences(mUtils.repeat_alarm_poweron_time);
               mUtils.remove_String_From_SharedPreferences(mUtils.repeat_alarm_poweroff_time);
               
               mUtils.remove_int_From_SharedPreferences(mUtils.set_time_reboot_h);
               mUtils.remove_int_From_SharedPreferences(mUtils.set_time_reboot_m);
               mUtils.remove_int_From_SharedPreferences(mUtils.set_time_reboot_s);
           }
           
           
           
           new Thread(new Runnable() {
               
               @Override
               public void run() {
                   // TODO Auto-generated method stub
                   
                   try {
                       Thread.sleep(20*1000);
                       start_service(context);
                       Thread.sleep(60*1000);
                       start_service(context);
                   } catch (InterruptedException e) {
                       // TODO Auto-generated catch block
                       e.printStackTrace();
                   }
                   
               }
           }).start();
           
       }
   }
   
   
   private void start_service(Context context)
   {
       if(!mUtils.isServiceRunning(context, "com.pqlabs.updatefirmware.UpdateFirmwareService"))
       {
           Intent i = new Intent();
           i.setComponent(new ComponentName("com.pqlabs.updatefirmware","com.pqlabs.updatefirmware.UpdateFirmwareService"));
           context.startService(i);
       }
       
       
       
       if(!mUtils.isServiceRunning(context, "com.jw.sysupdate.service.The_Service"))
       {
           Intent intent_sysupdate = new Intent();
           intent_sysupdate.setComponent(new ComponentName("com.jw.sysupdate","com.jw.sysupdate.service.The_Service"));
           context.startService(intent_sysupdate);
           
       }
       
       if(!mUtils.isServiceRunning(context, "logcat_tools.LogService"))
       {
           Intent intent_Log = new Intent();
           intent_Log.setComponent(new ComponentName("com.jwipc.toolbox","logcat_tools.LogService"));
           context.startService(intent_Log);
           
       }
   }
   
   
   
   
   
   
   
   
   
   
   
 
}