|
|
|
@ -229,31 +229,31 @@ public class MainActivity extends AppCompatActivity implements RefreshListView.I
|
|
|
|
|
protected void onResume() {
|
|
|
|
|
super.onResume();
|
|
|
|
|
|
|
|
|
|
//是否同意隐私协议
|
|
|
|
|
if (!MyApplication.allowPrivacyPolicy) return;
|
|
|
|
|
try {
|
|
|
|
|
//是否同意隐私协议
|
|
|
|
|
if (!MyApplication.allowPrivacyPolicy) return;
|
|
|
|
|
|
|
|
|
|
//第一次打开,未授权无法获取SIM信息,尝试在此重新获取
|
|
|
|
|
if (MyApplication.SimInfoList.isEmpty()) {
|
|
|
|
|
MyApplication.SimInfoList = PhoneUtils.getSimMultiInfo();
|
|
|
|
|
}
|
|
|
|
|
Log.d(TAG, "SimInfoList = " + MyApplication.SimInfoList.size());
|
|
|
|
|
//第一次打开,未授权无法获取SIM信息,尝试在此重新获取
|
|
|
|
|
if (MyApplication.SimInfoList.isEmpty()) {
|
|
|
|
|
MyApplication.SimInfoList = PhoneUtils.getSimMultiInfo();
|
|
|
|
|
}
|
|
|
|
|
Log.d(TAG, "SimInfoList = " + MyApplication.SimInfoList.size());
|
|
|
|
|
|
|
|
|
|
//省电优化设置为无限制
|
|
|
|
|
if (MyApplication.showHelpTip && Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
|
|
|
|
if (!KeepAliveUtils.isIgnoreBatteryOptimization(this)) {
|
|
|
|
|
Toast.makeText(this, R.string.tips_battery_optimization, Toast.LENGTH_LONG).show();
|
|
|
|
|
//省电优化设置为无限制
|
|
|
|
|
if (MyApplication.showHelpTip && Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
|
|
|
|
if (!KeepAliveUtils.isIgnoreBatteryOptimization(this)) {
|
|
|
|
|
Toast.makeText(this, R.string.tips_battery_optimization, Toast.LENGTH_LONG).show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//开启读取通知栏权限
|
|
|
|
|
if (SettingUtil.getSwitchEnableAppNotify() && !CommonUtil.isNotificationListenerServiceEnabled(this)) {
|
|
|
|
|
CommonUtil.toggleNotificationListenerService(this);
|
|
|
|
|
SettingUtil.switchEnableAppNotify(false);
|
|
|
|
|
Toast.makeText(this, R.string.tips_notification_listener, Toast.LENGTH_LONG).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//开启读取通知栏权限
|
|
|
|
|
if (SettingUtil.getSwitchEnableAppNotify() && !CommonUtil.isNotificationListenerServiceEnabled(this)) {
|
|
|
|
|
CommonUtil.toggleNotificationListenerService(this);
|
|
|
|
|
SettingUtil.switchEnableAppNotify(false);
|
|
|
|
|
Toast.makeText(this, R.string.tips_notification_listener, Toast.LENGTH_LONG).show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
if (serviceIntent != null) startService(serviceIntent);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
Log.e(TAG, "onResume:", e);
|
|
|
|
|