version:m40se 3.0.2

fix:
update:优化耗电和管控逻辑
This commit is contained in:
2023-06-17 09:24:50 +08:00
parent a6fd0862e3
commit cf04e4c0b8
10 changed files with 73 additions and 51 deletions

View File

@@ -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'

Binary file not shown.

View File

@@ -46,7 +46,7 @@
<!-- 允许访问振动设备 -->
<uses-permission android:name="android.permission.VIBRATE"/>
<!-- 允许使用PowerManager的 WakeLocks保持进程在休眠时从屏幕消失 -->
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- <uses-permission android:name="android.permission.WAKE_LOCK"/>-->
<!-- 允许程序读取或写入系统设置 -->
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<!-- android 9.0上使用前台服务,需要添加权限 -->

View File

@@ -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();
}

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -2809,30 +2809,30 @@ public class NetInterfaceManager {
}
public void getAdminApp() {
getAdminAppObservable()
.subscribe(new Observer<BaseResponse<List<AppInfo>>>() {
@Override
public void onSubscribe(@NonNull Disposable d) {
Log.e("getAdminApp", "onSubscribe: ");
}
@Override
public void onNext(@NonNull BaseResponse<List<AppInfo>> 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<BaseResponse<List<AppInfo>>>() {
// @Override
// public void onSubscribe(@NonNull Disposable d) {
// Log.e("getAdminApp", "onSubscribe: ");
// }
//
// @Override
// public void onNext(@NonNull BaseResponse<List<AppInfo>> 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();

View File

@@ -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)
) {

View File

@@ -79,9 +79,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
//执行所有请求的时间
long runningTime;
//MainService上次执行时间
long startCommandTime = 0;
private final BehaviorSubject<ActivityEvent> 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;
}