@@ -574,6 +574,8 @@ protected void onActivityResult(int requestCode, int resultCode, final Intent da
574
574
} else if (requestCode == REQUEST_BATTERY_OPTIMIZATION ) {
575
575
if (resultCode != RESULT_OK )
576
576
checkDoze ();
577
+ else
578
+ checkDataSaving ();
577
579
578
580
} else {
579
581
Log .w (TAG , "Unknown activity result request=" + requestCode );
@@ -1075,8 +1077,7 @@ private void updateSearch(String search) {
1075
1077
1076
1078
private void checkDoze () {
1077
1079
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .M ) {
1078
- final Intent doze = new Intent (Settings .ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS );
1079
- if (Util .batteryOptimizing (this ) && getPackageManager ().resolveActivity (doze , 0 ) != null ) {
1080
+ if (Util .batteryOptimizing (this )) {
1080
1081
final SharedPreferences prefs = PreferenceManager .getDefaultSharedPreferences (this );
1081
1082
if (!prefs .getBoolean ("nodoze" , false )) {
1082
1083
LayoutInflater inflater = LayoutInflater .from (this );
@@ -1089,25 +1090,23 @@ private void checkDoze() {
1089
1090
@ Override
1090
1091
public void onClick (DialogInterface dialog , int which ) {
1091
1092
prefs .edit ().putBoolean ("nodoze" , cbDontAsk .isChecked ()).apply ();
1092
- if (!Util .isPlayStoreInstall ()) {
1093
- Intent i = new Intent (Settings .ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS )
1094
- .setData (Uri .parse ("package:" + getPackageName ()));
1095
- startActivityForResult (i , REQUEST_BATTERY_OPTIMIZATION );
1096
- } else
1097
- startActivity (doze );
1093
+ Intent i = new Intent (Settings .ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS )
1094
+ .setData (Uri .parse ("package:" + getPackageName ()));
1095
+ startActivityForResult (i , REQUEST_BATTERY_OPTIMIZATION );
1098
1096
}
1099
1097
})
1100
1098
.setNegativeButton (android .R .string .no , new DialogInterface .OnClickListener () {
1101
1099
@ Override
1102
1100
public void onClick (DialogInterface dialog , int which ) {
1103
1101
prefs .edit ().putBoolean ("nodoze" , cbDontAsk .isChecked ()).apply ();
1102
+ checkDataSaving ();
1104
1103
}
1105
1104
})
1106
1105
.setOnDismissListener (new DialogInterface .OnDismissListener () {
1107
1106
@ Override
1108
1107
public void onDismiss (DialogInterface dialogInterface ) {
1109
1108
dialogDoze = null ;
1110
- checkDataSaving ();
1109
+ // checkDataSaving();
1111
1110
}
1112
1111
})
1113
1112
.create ();
0 commit comments