Skip to content

Commit a3bc946

Browse files
committed
gmscompat: skip location settings check activity when rerouting is on
LocationSettingsCheckerActivity is launched by location service clients to ask the user to adjust location settings. It's irrelevant when hybrid location service is enabled.
1 parent 955fbe0 commit a3bc946

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

core/java/com/android/internal/gmscompat/GmsHooks.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,20 @@ public static void onActivityStart(int resultCode, Intent intent, int requestCod
511511

512512
// Activity#onCreate(Bundle)
513513
public static void activityOnCreate(Activity activity) {
514-
514+
if (!GmsCompat.isGmsCore()) {
515+
return;
516+
}
517+
if (activity.getClass().getName().equals("com.google.android.location.settings.LocationSettingsCheckerActivity")) {
518+
try {
519+
if (!GmsCompatApp.iGms2Gca().isHybridLocationServiceEnabled()) {
520+
return;
521+
}
522+
} catch (RemoteException e) {
523+
throw GmsCompatApp.callFailed(e);
524+
}
525+
Log.d(TAG, "hybrid location service is enabled, finishing LocationSettingsCheckerActivity");
526+
activity.finish();
527+
}
515528
}
516529

517530
// ContentResolver#insert(Uri, ContentValues, Bundle)

core/java/com/android/internal/gmscompat/IGms2Gca.aidl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,6 @@ interface IGms2Gca {
4747
Notification getMediaProjectionNotification();
4848

4949
void raisePackageToForeground(String targetPkg, long durationMs, @nullable String reason, int reasonCode);
50+
51+
boolean isHybridLocationServiceEnabled();
5052
}

0 commit comments

Comments
 (0)