Revert "Allow location provider to deep link into permissions UI"
This reverts commit ed98828335.
Reason for revert: The exposed API is not needed anymore
Test: Built
Bug: 118437704
Change-Id: I155eb0f7241327b34ea5beaabee514ba2a018998
This commit is contained in:
@@ -1060,7 +1060,6 @@ package android.content {
|
||||
field public static final java.lang.String ACTION_INSTALL_INSTANT_APP_PACKAGE = "android.intent.action.INSTALL_INSTANT_APP_PACKAGE";
|
||||
field public static final java.lang.String ACTION_INSTANT_APP_RESOLVER_SETTINGS = "android.intent.action.INSTANT_APP_RESOLVER_SETTINGS";
|
||||
field public static final java.lang.String ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION";
|
||||
field public static final java.lang.String ACTION_MANAGE_APP_PERMISSION = "android.intent.action.MANAGE_APP_PERMISSION";
|
||||
field public static final java.lang.String ACTION_MANAGE_APP_PERMISSIONS = "android.intent.action.MANAGE_APP_PERMISSIONS";
|
||||
field public static final java.lang.String ACTION_MANAGE_PERMISSIONS = "android.intent.action.MANAGE_PERMISSIONS";
|
||||
field public static final java.lang.String ACTION_MANAGE_PERMISSION_APPS = "android.intent.action.MANAGE_PERMISSION_APPS";
|
||||
@@ -2730,7 +2729,6 @@ package android.location {
|
||||
public class LocationManager {
|
||||
method public deprecated boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
|
||||
method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
|
||||
method public android.app.PendingIntent createManageLocationPermissionIntent(java.lang.String, java.lang.String);
|
||||
method public void flushGnssBatch();
|
||||
method public int getGnssBatchSize();
|
||||
method public java.lang.String getNetworkProviderPackage();
|
||||
|
||||
@@ -1756,33 +1756,6 @@ public class Intent implements Parcelable, Cloneable {
|
||||
public static final String ACTION_MANAGE_APP_PERMISSIONS =
|
||||
"android.intent.action.MANAGE_APP_PERMISSIONS";
|
||||
|
||||
/**
|
||||
* Activity action: Launch UI to manage a specific permissions of an app.
|
||||
* <p>
|
||||
* Input: {@link #EXTRA_PACKAGE_NAME} specifies the package whose permission
|
||||
* will be managed by the launched UI.
|
||||
* </p>
|
||||
* <p>
|
||||
* Input: {@link #EXTRA_PERMISSION_NAME} specifies the (individual) permission
|
||||
* that should be managed by the launched UI.
|
||||
* </p>
|
||||
* <p>
|
||||
* <li> {@link #EXTRA_USER} specifies the UserHandle of the user that owns the app.
|
||||
* </p>
|
||||
* <p>
|
||||
* Output: Nothing.
|
||||
* </p>
|
||||
*
|
||||
* @see #EXTRA_PACKAGE_NAME
|
||||
* @see #EXTRA_PERMISSION_NAME
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ACTION_MANAGE_APP_PERMISSION =
|
||||
"android.intent.action.MANAGE_APP_PERMISSION";
|
||||
|
||||
/**
|
||||
* Activity action: Launch UI to manage permissions.
|
||||
* <p>
|
||||
|
||||
@@ -121,18 +121,4 @@ interface ILocationManager
|
||||
|
||||
// used by gts tests to verify throttling whitelist
|
||||
String[] getBackgroundThrottlingWhitelist();
|
||||
|
||||
/**
|
||||
* Allow the {@link android.location.LocationManager#getNetworkProviderPackage location
|
||||
* provider} to start the UI to modify the location permission for a package.
|
||||
*
|
||||
* <p>Can only be called by the location provider.
|
||||
*
|
||||
* @param packageName The package the permission belongs to
|
||||
* @param permission The (individual) permission to switch
|
||||
*
|
||||
* @return A pending intent that starts the permission management UI or {@code null} if the
|
||||
* intent cannot be created
|
||||
*/
|
||||
PendingIntent createManageLocationPermissionIntent(in String packageName, in String permission);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import static android.Manifest.permission.LOCATION_HARDWARE;
|
||||
import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.RequiresFeature;
|
||||
import android.annotation.RequiresPermission;
|
||||
@@ -2401,29 +2400,4 @@ public class LocationManager {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow the {@link android.location.LocationManager#getNetworkProviderPackage location
|
||||
* provider} to start the UI to modify the location permission for a package.
|
||||
*
|
||||
* <p>Can only be called by the location provider.
|
||||
*
|
||||
* @param packageName The package the permission belongs to
|
||||
* @param permission The (individual) location permission to switch
|
||||
*
|
||||
* @return A one-shot pending intent that starts the permission management UI or {@code null} if
|
||||
* the intent cannot be created
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public @Nullable PendingIntent createManageLocationPermissionIntent(@NonNull String packageName,
|
||||
@NonNull String permission) {
|
||||
try {
|
||||
return mService.createManageLocationPermissionIntent(packageName, permission);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.server;
|
||||
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
|
||||
import static android.provider.Settings.Global.LOCATION_DISABLE_STATUS_CALLBACKS;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
@@ -85,7 +84,6 @@ import com.android.internal.location.ProviderRequest;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.internal.util.DumpUtils;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.server.location.ActivityRecognitionProxy;
|
||||
import com.android.server.location.GeocoderProxy;
|
||||
import com.android.server.location.GeofenceManager;
|
||||
@@ -114,7 +112,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -3413,48 +3410,6 @@ public class LocationManagerService extends ILocationManager.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PendingIntent createManageLocationPermissionIntent(String packageName,
|
||||
String permission) {
|
||||
Preconditions.checkNotNull(packageName);
|
||||
Preconditions.checkArgument(permission.equals(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
|| permission.equals(Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||
|| permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION));
|
||||
|
||||
int callingUid = Binder.getCallingUid();
|
||||
long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
String locProvider = getNetworkProviderPackage();
|
||||
if (locProvider == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PackageInfo locProviderInfo;
|
||||
try {
|
||||
locProviderInfo = mContext.getPackageManager().getPackageInfo(
|
||||
locProvider, PackageManager.MATCH_DIRECT_BOOT_AUTO);
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "Could not resolve " + locProvider, e);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (locProviderInfo.applicationInfo.uid != callingUid) {
|
||||
throw new SecurityException("Only " + locProvider + " can call this API");
|
||||
}
|
||||
|
||||
Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSION);
|
||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, packageName);
|
||||
intent.putExtra(Intent.EXTRA_PERMISSION_NAME, permission);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
return PendingIntent.getActivity(mContext,
|
||||
Objects.hash(packageName, permission), intent,
|
||||
PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
private void log(String log) {
|
||||
if (Log.isLoggable(TAG, Log.VERBOSE)) {
|
||||
Slog.d(TAG, log);
|
||||
|
||||
Reference in New Issue
Block a user