.idea/misc.xml
.. .. @@ -1,7 +1,7 @@ 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <project version="4"> 3 3 <component name="ExternalStorageConfigurationManager" enabled="true" /> 4  - <component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">4  + <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">5 5 <output url="file://$PROJECT_DIR$/build/classes" /> 6 6 </component> 7 7 <component name="ProjectType"> .idea/vcs.xml
.. .. @@ -0,0 +1,6 @@ 1  +<?xml version="1.0" encoding="UTF-8"?>2  +<project version="4">3  + <component name="VcsDirectoryMappings">4  + <mapping directory="$PROJECT_DIR$" vcs="Git" />5  + </component>6  +</project>app/.gitignore
.. .. @@ -0,0 +1 @@ 1  +/buildapp/build.gradle
.. .. @@ -5,13 +5,31 @@ 5 5 buildToolsVersion "33.0.0" 6 6 7 7 defaultConfig { 8  - applicationId "com.jwipc.nodka_reboot_under"8  + applicationId "com.nodka.reboot_under"9 9 minSdkVersion 25 10 10 targetSdkVersion 25 11 11 } 12 12 13  + sourceSets.main {14  + jni.srcDirs = []15  + jniLibs.srcDir "src/main/libs"16  + }17  +18  + signingConfigs {19  + platformkeystore {20  + keyAlias "platform"21  + keyPassword "android"22  + storeFile file('../app/keystore/platform.jks')23  + storePassword "android"24  + }25  + }26  +13 27 buildTypes { 28  + debug {29  + signingConfig signingConfigs.platformkeystore30  + }14 31 release { 32  + signingConfig signingConfigs.platformkeystore15 33 minifyEnabled false 16 34 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 35 } .. .. @@ -19,6 +37,7 @@ 19 37 } 20 38 21 39 dependencies { 22  - compile 'com.android.support:support-v4:25.+'23  - compile files('libs/spirit.jar')40  + implementation 'com.android.support:support-v4:25.+'41  + implementation files('libs/spirit.jar')42  + implementation files('libs/NodkaAPI.jar')24 43 } app/keystore/platform.jksBinary files differ
app/libs/NodkaAPI.jarBinary files differ
app/src/main/AndroidManifest.xml
.. .. @@ -13,6 +13,7 @@ 13 13 14 14 15 15 <application 16  + android:name=".MyApplication"16 17 android:allowBackup="true" 17 18 android:icon="@drawable/ic_launcher" 18 19 android:label="@string/app_name" app/src/main/java/com/jwipc/nodka_reboot_under/BroadcastReceiver_Boot.java
.. .. @@ -52,9 +52,12 @@ 52 52 String is_repeat = mUtils.get_String_From_SharedPreferences(mUtils.set_time_reboot_repeat); 53 53 if(!is_repeat.equals("true")) 54 54 { 55  -56  - AlarmPowerManager mAlarmPowerManager = new AlarmPowerManager();57  - mAlarmPowerManager.removeAllalarmPower();55  + if (mUtils.isSpiritVersion()) {56  + AlarmPowerManager mAlarmPowerManager = new AlarmPowerManager();57  + mAlarmPowerManager.removeAllalarmPower();58  + } else {59  + MyApplication.getApplication().getNodkaAPI().alarm_removeAllalarmPower();60  + }58 61 59 62 mUtils.remove_String_From_SharedPreferences(mUtils.repeat_alarm_poweron_time); 60 63 mUtils.remove_String_From_SharedPreferences(mUtils.repeat_alarm_poweroff_time); .. .. @@ -66,7 +69,7 @@ 66 69 67 70 68 71 69  - new Thread(new Runnable() {72  + /*new Thread(new Runnable() {70 73 71 74 @Override 72 75 public void run() { .. .. @@ -83,7 +86,7 @@ 83 86 } 84 87 85 88 } 86  - }).start();89  + }).start();*/87 90 88 91 } 89 92 } app/src/main/java/com/jwipc/nodka_reboot_under/BroadcastReceiver_Power.java
.. .. @@ -11,7 +11,6 @@ 11 11 12 12 public class BroadcastReceiver_Power extends BroadcastReceiver{ 13 13 14  -15 14 Utils mUtils = null; 16 15 17 16 SharedPreferences sharedPreferences; .. .. @@ -103,7 +102,7 @@ 103 102 String power_off_time = intent.getExtras().getString("shut_time", ""); 104 103 String repeat = intent.getExtras().getString("repeat", ""); 105 104 int power_type = intent.getExtras().getInt("power_type", -1); 106  -105  +107 106 switch (power_type) { 108 107 case 1: 109 108 //mUtils.reboot(); app/src/main/java/com/jwipc/nodka_reboot_under/MyApplication.java
.. .. @@ -0,0 +1,31 @@ 1  +package com.jwipc.nodka_reboot_under;2  +3  +import android.app.Application;4  +5  +import com.nodka.api.NodkaAPI;6  +7  +public class MyApplication extends Application {8  +9  + private NodkaAPI mNodkaAPI;10  + private static MyApplication mApp;11  +12  + @Override13  + public void onCreate() {14  + super.onCreate();15  + mApp = this;16  + createNorcoAPI();17  + }18  +19  + public static MyApplication getApplication() {20  + return mApp;21  + }22  +23  + private void createNorcoAPI() {24  + mNodkaAPI = NodkaAPI.nodkaAPICreate(this);25  + mNodkaAPI.alarm_start();26  + }27  +28  + public NodkaAPI getNodkaAPI() {29  + return mNodkaAPI;30  + }31  +}app/src/main/java/com/jwipc/nodka_reboot_under/utils/Utils.java
.. .. @@ -24,10 +24,15 @@ 24 24 import android.net.ConnectivityManager; 25 25 import android.net.NetworkInfo; 26 26 import android.net.NetworkInfo.DetailedState; 27  +import android.os.Build;27 28 import android.os.PowerManager; 28 29 import android.os.RemoteException; 29 30 import android.text.format.DateFormat; 30 31 import android.util.Log; 32  +33  +import com.jwipc.nodka_reboot_under.MyApplication;34  +import com.nodka.api.NodkaAPI;35  +import com.nodka.api.NodkaNative;31 36 32 37 33 38 public class Utils { .. .. @@ -67,8 +72,7 @@ 67 72 Thread thread_set_time_reboot = null; 68 73 Thread thread_STOP_WATCH_DOG = null; 69 74 Thread thread_AlarmPower_Repeat_Poweroff = null; 70  -71  -75  +72 76 73 77 74 78 public Utils(Context context) { .. .. @@ -80,7 +84,6 @@ 80 84 sharedPreferences = context.getSharedPreferences(shapre, context.MODE_PRIVATE); 81 85 editor = sharedPreferences.edit(); 82 86 } 83  -84 87 85 88 public void shut_Down() 86 89 { .. .. @@ -250,26 +253,30 @@ 250 253 return; 251 254 } 252 255 253  -254  - AlarmPowerManager mAlarmPowerManager = new AlarmPowerManager();255  -256  - mAlarmPowerManager.removeAllalarmPower();257  -256  + if (isSpiritVersion()) {257  + new AlarmPowerManager().removeAllalarmPower();258  + setFileState("0", "/sys/class/minix-rtc/MCURTCDATA");259  + } else {260  + MyApplication.getApplication().getNodkaAPI().alarm_removeAllalarmPower();261  + setFileState("0", "/sys/class/minix-rtc/minix_RTC_DATA");262  + }263  +258 264 editor.putString(repeat_alarm_poweron_time, ""); 259 265 editor.putString(repeat_alarm_poweroff_time, ""); 260 266 editor.commit(); 261  -262  - setFileState("0", "/sys/class/minix-rtc/MCURTCDATA");263  -267  +264 268 if(active) 265 269 { 266 270 if(repeat.equals("true")) 267 271 { 268  - SpiritAlarmManager mSpiritAlarmManager = new SpiritAlarmManager();269  - mSpiritAlarmManager.setSpiritAlarmWithDay(1, hms_on[0], hms_on[1]);270  -271  - setFileState("1", "/sys/class/minix-rtc/MCURTCDATA");272  -272  + if (isSpiritVersion()) {273  + new SpiritAlarmManager().setSpiritAlarmWithDay(1, hms_on[0], hms_on[1]);274  + setFileState("1", "/sys/class/minix-rtc/MCURTCDATA");275  + } else {276  + MyApplication.getApplication().getNodkaAPI().alarm_setSpiritAlarmWithDay(1, hms_on[0], hms_on[1]);277  + setFileState("1", "/sys/class/minix-rtc/minix_RTC_DATA");278  + }279  +273 280 editor.putString(repeat_alarm_poweron_time, hms_on[0]+":"+hms_on[1]+":"+0); 274 281 editor.putString(repeat_alarm_poweroff_time, hms_off[0]+":"+hms_off[1]+":"+0); 275 282 editor.commit(); .. .. @@ -284,22 +291,37 @@ 284 291 editor.commit(); 285 292 286 293 Calendar calendar = Calendar.getInstance(); 287  -288  - // 改接口 setSpiritAlarmWithDay()289  - mAlarmPowerManager.CreatOneAlarmPower(calendar.get(Calendar.YEAR)+"",290  - calendar.get(Calendar.MONTH)+1+"",291  - calendar.get(Calendar.DAY_OF_MONTH)+"",292  - hms_on[0]+"",293  - hms_on[1]+"",294  - hms_on[2]+"",295  - hms_off[0]+"",296  - hms_off[1]+"",297  - hms_off[2]+"",298  - hms_on[0]>12? "0":"1",299  - hms_off[0]>12? "0":"1");300  -301  - mAlarmPowerManager.updateAlarmPowerActive(0, active+"");302  -294  +295  + if (isSpiritVersion()) {296  + // 改接口 setSpiritAlarmWithDay()297  + new AlarmPowerManager().CreatOneAlarmPower(calendar.get(Calendar.YEAR)+"",298  + calendar.get(Calendar.MONTH)+1+"",299  + calendar.get(Calendar.DAY_OF_MONTH)+"",300  + hms_on[0]+"",301  + hms_on[1]+"",302  + hms_on[2]+"",303  + hms_off[0]+"",304  + hms_off[1]+"",305  + hms_off[2]+"",306  + hms_on[0]>12? "0":"1",307  + hms_off[0]>12? "0":"1");308  +309  + new AlarmPowerManager().updateAlarmPowerActive(0, active+"");310  + } else {311  + MyApplication.getApplication().getNodkaAPI().alarm_creatOneAlarmPower(calendar.get(Calendar.YEAR)+"",312  + calendar.get(Calendar.MONTH)+1+"",313  + calendar.get(Calendar.DAY_OF_MONTH)+"",314  + hms_on[0]+"",315  + hms_on[1]+"",316  + hms_on[2]+"",317  + hms_off[0]+"",318  + hms_off[1]+"",319  + hms_off[2]+"",320  + hms_on[0]>12? "0":"1",321  + hms_off[0]>12? "0":"1");322  +323  + MyApplication.getApplication().getNodkaAPI().alarm_updateAlarmPowerActive(0, active+"");324  + }303 325 } 304 326 } 305 327 } .. .. @@ -667,7 +689,9 @@ 667 689 return re; 668 690 } 669 691 670  -671  -672  -692  + public boolean isSpiritVersion() {693  + return Build.VERSION.SDK_INT <= 25;694  + }695  +696  +673 697 } app/src/main/libs/arm64-v8a/libnodka-jni.soBinary files differ
build.gradle
.. .. @@ -2,6 +2,7 @@ 2 2 buildscript { 3 3 repositories { 4 4 jcenter() 5  + google()5 6 } 6 7 dependencies { 7 8 classpath 'com.android.tools.build:gradle:7.3.0' .. .. @@ -11,5 +12,6 @@ 11 12 allprojects { 12 13 repositories { 13 14 jcenter() 15  + google()14 16 } 15 17 }