File tree 1 file changed +9
-1
lines changed
extensions/shared/library/src/main/java/app/revanced/extension/shared
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,11 @@ public static void checkGmsCore(Activity context) {
106
106
}
107
107
108
108
// Check if GmsCore is whitelisted from battery optimizations.
109
- if (batteryOptimizationsEnabled (context )) {
109
+ if (isAndroidAutomotive (context )) {
110
+ // Ignore Android Automotive devices (Google built-in),
111
+ // as there is no way to disable battery optimizations.
112
+ Logger .printDebug (() -> "Device is Android Automotive" );
113
+ } else if (batteryOptimizationsEnabled (context )) {
110
114
Logger .printInfo (() -> "GmsCore is not whitelisted from battery optimizations" );
111
115
112
116
showBatteryOptimizationDialog (context ,
@@ -147,6 +151,10 @@ private static boolean batteryOptimizationsEnabled(Context context) {
147
151
return !powerManager .isIgnoringBatteryOptimizations (GMS_CORE_PACKAGE_NAME );
148
152
}
149
153
154
+ private static boolean isAndroidAutomotive (Context context ) {
155
+ return context .getPackageManager ().hasSystemFeature (PackageManager .FEATURE_AUTOMOTIVE );
156
+ }
157
+
150
158
private static String getGmsCoreDownload () {
151
159
final var vendorGroupId = getGmsCoreVendorGroupId ();
152
160
//noinspection SwitchStatementWithTooFewBranches
You can’t perform that action at this time.
0 commit comments