mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-01 15:14:34 +02:00
fix(GmsCore support): Do not show battery optimization error on Android Automotive devices (Google built-in)
This commit is contained in:
parent
b105fc1f62
commit
41aaeafbe9
@ -120,7 +120,11 @@ public class GmsCoreSupport {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if GmsCore is whitelisted from battery optimizations.
|
// Check if GmsCore is whitelisted from battery optimizations.
|
||||||
if (batteryOptimizationsEnabled(mActivity)) {
|
if (isAndroidAutomotive(mActivity)) {
|
||||||
|
// Ignore Android Automotive devices (Google built-in),
|
||||||
|
// as there is no way to disable battery optimizations.
|
||||||
|
Logger.printDebug(() -> "Device is Android Automotive");
|
||||||
|
} else if (batteryOptimizationsEnabled(mActivity)) {
|
||||||
Logger.printInfo(() -> "GmsCore is not whitelisted from battery optimizations");
|
Logger.printInfo(() -> "GmsCore is not whitelisted from battery optimizations");
|
||||||
showBatteryOptimizationDialog(mActivity,
|
showBatteryOptimizationDialog(mActivity,
|
||||||
"gms_core_dialog_not_whitelisted_using_battery_optimizations_message",
|
"gms_core_dialog_not_whitelisted_using_battery_optimizations_message",
|
||||||
@ -220,6 +224,10 @@ public class GmsCoreSupport {
|
|||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isAndroidAutomotive(Context context) {
|
||||||
|
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
|
||||||
|
}
|
||||||
|
|
||||||
private static String getGmsCoreDownload() {
|
private static String getGmsCoreDownload() {
|
||||||
final String vendorGroupId = getGmsCoreVendorGroupId();
|
final String vendorGroupId = getGmsCoreVendorGroupId();
|
||||||
return switch (vendorGroupId) {
|
return switch (vendorGroupId) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user