Merge "Fix bugs in LocationManagerService and AppOpsPolicy" into sc-dev

This commit is contained in:
Soonil Nagarkar
2021-06-16 15:37:32 +00:00
committed by Android (Google) Code Review
9 changed files with 350 additions and 238 deletions

View File

@@ -16,14 +16,10 @@
package android.location;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.location.util.identity.CallerIdentity;
import com.android.internal.annotations.Immutable;
import java.util.Set;
import android.os.PackageTagsList;
/**
* Location manager local system service interface.
@@ -43,18 +39,14 @@ public abstract class LocationManagerInternal {
}
/**
* Interface for getting callbacks when a location provider's location tags change.
*
* @see LocationTagInfo
* Interface for getting callbacks when an app id's location provider package tags change.
*/
public interface OnProviderLocationTagsChangeListener {
public interface LocationPackageTagsListener {
/**
* Called when the location tags for a provider change.
*
* @param providerLocationTagInfo The tag info for a provider.
* Called when the package tags for a location provider change for a uid.
*/
void onLocationTagsChanged(@NonNull LocationTagInfo providerLocationTagInfo);
void onLocationPackageTagsChanged(int uid, @NonNull PackageTagsList packageTagsList);
}
/**
@@ -109,58 +101,9 @@ public abstract class LocationManagerInternal {
public abstract @Nullable LocationTime getGnssTimeMillis();
/**
* Sets a listener for changes in the location providers' tags. Passing
* Sets a listener for changes in an app id's location provider package tags. Passing
* {@code null} clears the current listener.
*
* @param listener The listener.
*/
public abstract void setOnProviderLocationTagsChangeListener(
@Nullable OnProviderLocationTagsChangeListener listener);
/**
* This class represents the location permission tags used by the location provider
* packages in a given UID. These tags are strictly used for accessing state guarded
* by the location permission(s) by a location provider which are required for the
* provider to fulfill its function as being a location provider.
*/
@Immutable
public static class LocationTagInfo {
private final int mUid;
@NonNull
private final String mPackageName;
@Nullable
private final Set<String> mLocationTags;
public LocationTagInfo(int uid, @NonNull String packageName,
@Nullable Set<String> locationTags) {
mUid = uid;
mPackageName = packageName;
mLocationTags = locationTags;
}
/**
* @return The UID for which tags are related.
*/
public int getUid() {
return mUid;
}
/**
* @return The package for which tags are related.
*/
@NonNull
public String getPackageName() {
return mPackageName;
}
/**
* @return The tags for the package used for location related accesses.
*/
@Nullable
public Set<String> getTags() {
return mLocationTags;
}
}
public abstract void setLocationPackageTagsListener(
@Nullable LocationPackageTagsListener listener);
}