diff --git a/app/build.gradle b/app/build.gradle index 5a05576..2192600 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -73,8 +73,8 @@ android { official { flavorDimensions "default" - versionCode 40 - versionName "3.0.0" + versionCode 42 + versionName "3.0.2" } } @@ -89,6 +89,15 @@ android { v2SigningEnabled true } + zhanRuiUserdebug { + storeFile file("keystore/zhanxunUserdebug.keystore") + storePassword "123456" + keyAlias "zhanxunUserdebug" + keyPassword "123456" + v1SigningEnabled true + v2SigningEnabled false + } + teclastUnisoc { storeFile file("keystore/TeclastUnisoc.keystore") storePassword "123456" @@ -287,6 +296,9 @@ android { teclastUnisocUserdebug.initWith(zhanRuiDebug) teclastUnisocUserdebug { + manifestPlaceholders = [ + AK: "u5qGsILQ7qlXI8GDv6T6cGl8IWMtsPSu" + ] buildConfigField "String", "platform", '"M40SE"' versionNameSuffix "-debug" debuggable true @@ -313,6 +325,15 @@ android { signingConfig signingConfigs.zhanRui } + zhanRuiUserdebugReleas.initWith(debug) + zhanRuiUserdebugReleas { + manifestPlaceholders = [ + AK: "EiqcGW9LWDvfMKl7mZxUtt1UkNKpdQI5" + ] + buildConfigField "String", "platform", '"ZhanRui"' + signingConfig signingConfigs.zhanRuiUserdebug + } + debug { buildConfigField "String", "platform", '"MTK"' versionNameSuffix "-debug" @@ -404,8 +425,6 @@ dependencies { annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2' //磁盘缓存 implementation 'com.jakewharton:disklrucache:2.0.2' -// //fastjson -// implementation 'com.alibaba:fastjson:1.2.83' //Aria implementation 'com.arialyy.aria:core:3.8.15' annotationProcessor 'com.arialyy.aria:compiler:3.8.15' diff --git a/app/keystore/zhanxunUserdebug.keystore b/app/keystore/zhanxunUserdebug.keystore new file mode 100644 index 0000000..6d8f9ee Binary files /dev/null and b/app/keystore/zhanxunUserdebug.keystore differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c99c76a..253e093 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ - + diff --git a/app/src/main/java/com/fuying/sn/activity/main/MainActivity.java b/app/src/main/java/com/fuying/sn/activity/main/MainActivity.java index 6ac9936..c847026 100644 --- a/app/src/main/java/com/fuying/sn/activity/main/MainActivity.java +++ b/app/src/main/java/com/fuying/sn/activity/main/MainActivity.java @@ -238,6 +238,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView, @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); + Log.e(TAG, "onNewIntent: " ); if (REFRESHACTION.equals(intent.getAction())) { mPresenter.getSnInfo(); } @@ -374,6 +375,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView, class RefreshReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { + Log.e("RefreshReceiver", "onReceive: " ); if (REFRESHACTION.equals(intent.getAction())) { mPresenter.getSnInfo(); } diff --git a/app/src/main/java/com/fuying/sn/base/BaseApplication.java b/app/src/main/java/com/fuying/sn/base/BaseApplication.java index 5b2bbef..e4448d0 100644 --- a/app/src/main/java/com/fuying/sn/base/BaseApplication.java +++ b/app/src/main/java/com/fuying/sn/base/BaseApplication.java @@ -127,6 +127,7 @@ public class BaseApplication extends Application { private void tPushInit() { XGPushConfig.enableDebug(this, true); + XGPushConfig.enablePullUpOtherApp(this, false); XGPushManager.registerPush(this, new XGIOperateCallback() { @Override public void onSuccess(Object data, int flag) { diff --git a/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java b/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java index ee8b4da..5a0ed44 100644 --- a/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java +++ b/app/src/main/java/com/fuying/sn/desktop/RunningAppManager.java @@ -183,7 +183,7 @@ public class RunningAppManager { */ private void checkForegroundAppName() { String topPackage = getTopActivityInfo(); - if ("org.chromium.browser".equals(topPackage)){ + if ("org.chromium.browser".equals(topPackage)) { JGYUtils.getInstance().killPackage("org.chromium.browser"); } Log.i(TAG, "checkForegroundAppName: topPackage = " + topPackage); @@ -744,7 +744,6 @@ public class RunningAppManager { } } else { if (appTimeControl.getIs_quota() == 0) { -// ToastUtil.show("没有使用额度"); Log.e(TAG, "inControlTime: " + "没有使用额度"); return false; } @@ -1069,7 +1068,7 @@ public class RunningAppManager { // return restTime - todayTime <= 0; // } Log.i(TAG, "haveUseTime: " + globalRemainingTime); - return !(globalRemainingTime > 0); + return (globalRemainingTime > 0); } @@ -1183,7 +1182,8 @@ public class RunningAppManager { inPartTimes.add(inControlTime(partTime)); } //禁用时段需要满足所有 - return inPartTimes.indexOf(true) >= 0; + boolean inPartTime = inPartTimes.indexOf(true) >= 0; + return !inPartTime; } else if (partType == 1) { //开放时段只需要满足一个就行 for (PartTime partTime : partTimeHashSet) { diff --git a/app/src/main/java/com/fuying/sn/manager/AmapManager.java b/app/src/main/java/com/fuying/sn/manager/AmapManager.java index 070d5e4..567a5a2 100644 --- a/app/src/main/java/com/fuying/sn/manager/AmapManager.java +++ b/app/src/main/java/com/fuying/sn/manager/AmapManager.java @@ -22,7 +22,7 @@ public class AmapManager { private AmapManager(Context context) { this.mContext = context; - Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps"); +// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps"); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network"); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1); initAmap(); @@ -48,7 +48,7 @@ public class AmapManager { if (mLocationClient == null) { mLocationClient = new LocationClient(mContext); } - Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps"); +// Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+gps"); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "+network"); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 1); mLocationClient.setLocOption(getDefaultLocationClientOption()); @@ -132,8 +132,9 @@ public class AmapManager { } Log.e(TAG, "AmapAddress: " + (String) SPUtils.get(mContext, "AmapAddress", "-")); Log.e(TAG, "AmapError: " + (String) SPUtils.get(mContext, "AmapError", "-")); - Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-network"); Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-gps"); + Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, "-network"); + Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, ""); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 0); } diff --git a/app/src/main/java/com/fuying/sn/network/NetInterfaceManager.java b/app/src/main/java/com/fuying/sn/network/NetInterfaceManager.java index 4e9db29..2c5905e 100644 --- a/app/src/main/java/com/fuying/sn/network/NetInterfaceManager.java +++ b/app/src/main/java/com/fuying/sn/network/NetInterfaceManager.java @@ -2809,30 +2809,30 @@ public class NetInterfaceManager { } - public void getAdminApp() { - getAdminAppObservable() - .subscribe(new Observer>>() { - @Override - public void onSubscribe(@NonNull Disposable d) { - Log.e("getAdminApp", "onSubscribe: "); - } - - @Override - public void onNext(@NonNull BaseResponse> baseResponse) { - Log.e("getAdminApp", "onNext: " + baseResponse); - } - - @Override - public void onError(@NonNull Throwable e) { - Log.e("getAdminApp", "onError: "); - } - - @Override - public void onComplete() { - Log.e("getAdminApp", "onComplete: "); - } - }); - } +// public void getAdminApp() { +// getAdminAppObservable() +// .subscribe(new Observer>>() { +// @Override +// public void onSubscribe(@NonNull Disposable d) { +// Log.e("getAdminApp", "onSubscribe: "); +// } +// +// @Override +// public void onNext(@NonNull BaseResponse> baseResponse) { +// Log.e("getAdminApp", "onNext: " + baseResponse); +// } +// +// @Override +// public void onError(@NonNull Throwable e) { +// Log.e("getAdminApp", "onError: "); +// } +// +// @Override +// public void onComplete() { +// Log.e("getAdminApp", "onComplete: "); +// } +// }); +// } public interface WhiteListCallback { void onComplet(); diff --git a/app/src/main/java/com/fuying/sn/receiver/BootReceiver.java b/app/src/main/java/com/fuying/sn/receiver/BootReceiver.java index 8dda432..909b38e 100644 --- a/app/src/main/java/com/fuying/sn/receiver/BootReceiver.java +++ b/app/src/main/java/com/fuying/sn/receiver/BootReceiver.java @@ -27,16 +27,16 @@ public class BootReceiver extends BroadcastReceiver { String action = intent.getAction(); Log.e("SNBootReceiver", action); if (Intent.ACTION_BOOT_COMPLETED.equals(action) - || Intent.ACTION_BATTERY_CHANGED.equals(action) - || Intent.ACTION_BATTERY_LOW.equals(action) - || Intent.ACTION_BATTERY_OKAY.equals(action) - || Intent.ACTION_POWER_CONNECTED.equals(action) - || Intent.ACTION_POWER_DISCONNECTED.equals(action) - || Intent.ACTION_DATE_CHANGED.equals(action) - || Intent.ACTION_TIME_TICK.equals(action) - || Intent.ACTION_USER_PRESENT.equals(action) - || Intent.ACTION_SCREEN_ON.equals(action) - || Intent.ACTION_SCREEN_OFF.equals(action) +// || Intent.ACTION_BATTERY_CHANGED.equals(action) +// || Intent.ACTION_BATTERY_LOW.equals(action) +// || Intent.ACTION_BATTERY_OKAY.equals(action) +// || Intent.ACTION_POWER_CONNECTED.equals(action) +// || Intent.ACTION_POWER_DISCONNECTED.equals(action) +// || Intent.ACTION_DATE_CHANGED.equals(action) +// || Intent.ACTION_TIME_TICK.equals(action) +// || Intent.ACTION_USER_PRESENT.equals(action) +// || Intent.ACTION_SCREEN_ON.equals(action) +// || Intent.ACTION_SCREEN_OFF.equals(action) || BOOT_COMPLETED.equals(action) || "android.intent.action.BATTERY_LEVEL_CHANGED".equals(action) ) { diff --git a/app/src/main/java/com/fuying/sn/service/main/MainService.java b/app/src/main/java/com/fuying/sn/service/main/MainService.java index f4e0fe2..104dbc7 100644 --- a/app/src/main/java/com/fuying/sn/service/main/MainService.java +++ b/app/src/main/java/com/fuying/sn/service/main/MainService.java @@ -79,9 +79,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo //执行所有请求的时间 long runningTime; - //MainService上次执行时间 - long startCommandTime = 0; - private final BehaviorSubject lifecycleSubject = BehaviorSubject.create(); @NotNull @@ -124,6 +121,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo public void run() { // NetInterfaceManager.getInstance().updateAdminInfo(); if (JGYUtils.getInstance().isScreenOn()) { + Log.e(TAG, "getSnInfo1"); mPresenter.getSnInfo(); mPresenter.getAppAndWhite(); SPUtils.put(MainService.this, CommonConfig.JGY_FIRST_BOOT, 1); @@ -165,11 +163,12 @@ public class MainService extends Service implements MainSContact.MainView, Netwo Handler.getMain().postDelayed(new Runnable() { @Override public void run() { - Log.e("TimeObserver", "run: "+NetStateUtils.isNetworkConnected(MainService.this) ); + Log.e("TimeObserver", "run: " + NetStateUtils.isNetworkConnected(MainService.this)); if (NetStateUtils.isNetworkConnected(MainService.this)) { NetInterfaceManager.getInstance().getAppWhiteList(() -> { Log.e("TimeObserver", "onNext: getAppWhiteList"); }); + Log.e(TAG, "getSnInfo1"); mPresenter.getSnInfo(); mPresenter.getAppAndWhite(); NetInterfaceManager.getInstance().updateAdminInfo(); @@ -229,7 +228,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.e(TAG, "onStartCommand: " + System.currentTimeMillis()); - configStart.onstar("onStartCommand"); +// configStart.onstar("onStartCommand"); return START_STICKY; }