Allow location provider to deep link into permissions UI
Test: Built Bug: 118437704 Change-Id: I566acaf09bad27a47ec3822816c136c01b18bfc9
This commit is contained in:
@@ -22,6 +22,7 @@ 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;
|
||||
@@ -43,7 +44,9 @@ import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.location.ProviderProperties;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -2393,4 +2396,29 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user