[MA] mejora de opciones para bateria

This commit is contained in:
Luis Guzmán 2026-03-12 11:06:21 -06:00
parent 93398afc8e
commit a3cc0808e6
1 changed files with 38 additions and 30 deletions

View File

@ -405,34 +405,42 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
private void openBatterySettings(String manufacturer) { private void openBatterySettings(String manufacturer) {
boolean success = false;
if (manufacturer.contains("oppo") || manufacturer.contains("realme")) { if (manufacturer.contains("oppo") || manufacturer.contains("realme")) {
try { try {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity")); intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"));
startActivity(intent); startActivity(intent);
return; success = true;
} catch (Exception e) { } catch (Exception e) {
try { try {
Intent intent = new Intent(); Intent intent = new Intent();
intent.setComponent(new ComponentName("com.coloros.oppoguardelf", "com.coloros.oppoguardelf.Permission.BackgroundAllowAppListActivity")); intent.setComponent(new ComponentName("com.coloros.oppoguardelf", "com.coloros.oppoguardelf.Permission.BackgroundAllowAppListActivity"));
startActivity(intent); startActivity(intent);
return; success = true;
} catch (Exception e2) {} } catch (Exception e2) {}
} }
} else if (manufacturer.contains("xiaomi")) { }
else if (manufacturer.contains("xiaomi")) {
try { try {
Intent intent = new Intent("miui.intent.action.APP_BATTERY_SAVER_SETTINGS"); Intent intent = new Intent("miui.intent.action.APP_BATTERY_SAVER_SETTINGS");
intent.setComponent(new ComponentName("com.miui.powerkeeper", "com.miui.powerkeeper.ui.HiddenAppsConfigActivity")); intent.setComponent(new ComponentName("com.miui.powerkeeper", "com.miui.powerkeeper.ui.HiddenAppsConfigActivity"));
intent.putExtra("package_name", getPackageName()); intent.putExtra("package_name", getPackageName());
intent.putExtra("package_label", getString(R.string.app_name)); intent.putExtra("package_label", getString(R.string.app_name));
startActivity(intent); startActivity(intent);
return; success = true;
} catch (Exception e) {} } catch (Exception e) {}
} }
if (!success) {
try {
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
intent.setData(Uri.parse("package:" + getPackageName())); intent.setData(Uri.parse("package:" + getPackageName()));
startActivity(intent); startActivity(intent);
} catch (Exception ex) {
}
}
} }
private void toggleTheme() { private void toggleTheme() {