Loading core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -7132,7 +7132,7 @@ package android.app.admin { method public int getGlobalPrivateDnsMode(@NonNull android.content.ComponentName); method @NonNull public java.util.List<byte[]> getInstalledCaCerts(@Nullable android.content.ComponentName); method @Nullable public java.util.List<java.lang.String> getKeepUninstalledPackages(@Nullable android.content.ComponentName); method @NonNull public java.util.Set<java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String); method @NonNull public java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String); method public int getKeyguardDisabledFeatures(@Nullable android.content.ComponentName); method public int getLockTaskFeatures(@NonNull android.content.ComponentName); method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName); core/java/android/app/admin/DevicePolicyManager.java +10 −22 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; Loading Loading @@ -6460,12 +6461,14 @@ public class DevicePolicyManager { * to a given KeyChain key. * * Key are granted on a per-UID basis, so if several apps share the same UID, granting access to * one of them automatically grants it to others. This method returns a set of sets of package * names, where each internal set contains all packages sharing the same UID. Grantee packages * that don't share UID with other packages are represented by singleton sets. * one of them automatically grants it to others. This method returns a map containing one entry * per grantee UID. Entries have UIDs as keys and sets of corresponding package names as values. * In particular, grantee packages that don't share UID with other packages are represented by * entries having singleton sets as values. * * @param alias The alias of the key to grant access to. * @return package names of apps that have access to a given key, grouped by UIDs * @return apps that have access to a given key, arranged in a map from UID to sets of * package names. * * @throws SecurityException if the caller is not a device owner, a profile owner or * delegated certificate chooser. Loading @@ -6473,26 +6476,11 @@ public class DevicePolicyManager { * * @see #grantKeyPairToApp(ComponentName, String, String) */ public @NonNull Set<Set<String>> getKeyPairGrants(@NonNull String alias) { public @NonNull Map<Integer, Set<String>> getKeyPairGrants(@NonNull String alias) { throwIfParentInstance("getKeyPairGrants"); try { // Set of sets is flattened into a null-separated list. final List<String> flattened = mService.getKeyPairGrants(mContext.getPackageName(), alias); final Set<Set<String>> result = new HashSet<>(); Set<String> pkgsForOneUid = new HashSet<>(); for (final String pkg : flattened) { if (pkg == null) { result.add(pkgsForOneUid); pkgsForOneUid = new HashSet<>(); } else { pkgsForOneUid.add(pkg); } } if (!pkgsForOneUid.isEmpty()) { result.add(pkgsForOneUid); } return result; // The result is wrapped into intermediate parcelable representation. return mService.getKeyPairGrants(mContext.getPackageName(), alias).getPackagesByUid(); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading core/java/android/app/admin/IDevicePolicyManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package android.app.admin; import android.app.admin.NetworkEvent; import android.app.IApplicationThread; import android.app.IServiceConnection; import android.app.admin.ParcelableGranteeMap; import android.app.admin.StartInstallingUpdateCallback; import android.app.admin.SystemUpdateInfo; import android.app.admin.SystemUpdatePolicy; Loading Loading @@ -485,7 +486,7 @@ interface IDevicePolicyManager { boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags); boolean setKeyGrantForApp(in ComponentName admin, String callerPackage, String alias, String packageName, boolean hasGrant); List<String> getKeyPairGrants(in String callerPackage, in String alias); ParcelableGranteeMap getKeyPairGrants(in String callerPackage, in String alias); boolean setKeyGrantToWifiAuth(String callerPackage, String alias, boolean hasGrant); boolean isKeyPairGrantedToWifiAuth(String callerPackage, String alias); Loading core/java/android/app/admin/ParcelableGranteeMap.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; parcelable ParcelableGranteeMap; No newline at end of file core/java/android/app/admin/ParcelableGranteeMap.java 0 → 100644 +85 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.util.ArrayMap; import android.util.ArraySet; import java.util.Map; import java.util.Set; /** * Class for marshalling keypair grantees for a given KeyChain key via Binder. * * @hide */ public class ParcelableGranteeMap implements Parcelable { private final Map<Integer, Set<String>> mPackagesByUid; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mPackagesByUid.size()); for (final Map.Entry<Integer, Set<String>> uidEntry : mPackagesByUid.entrySet()) { dest.writeInt(uidEntry.getKey()); dest.writeStringArray(uidEntry.getValue().toArray(new String[0])); } } public static final @NonNull Parcelable.Creator<ParcelableGranteeMap> CREATOR = new Parcelable.Creator<ParcelableGranteeMap>() { @Override public ParcelableGranteeMap createFromParcel(Parcel source) { final Map<Integer, Set<String>> packagesByUid = new ArrayMap<>(); final int numUids = source.readInt(); for (int i = 0; i < numUids; i++) { final int uid = source.readInt(); final String[] pkgs = source.readStringArray(); packagesByUid.put(uid, new ArraySet<>(pkgs)); } return new ParcelableGranteeMap(packagesByUid); } @Override public ParcelableGranteeMap[] newArray(int size) { return new ParcelableGranteeMap[size]; } }; /** * Creates an instance holding a reference (not a copy) to the given map. */ public ParcelableGranteeMap(@NonNull Map<Integer, Set<String>> packagesByUid) { mPackagesByUid = packagesByUid; } /** * Returns a reference (not a copy) to the stored map. */ @NonNull public Map<Integer, Set<String>> getPackagesByUid() { return mPackagesByUid; } } Loading
core/api/current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -7132,7 +7132,7 @@ package android.app.admin { method public int getGlobalPrivateDnsMode(@NonNull android.content.ComponentName); method @NonNull public java.util.List<byte[]> getInstalledCaCerts(@Nullable android.content.ComponentName); method @Nullable public java.util.List<java.lang.String> getKeepUninstalledPackages(@Nullable android.content.ComponentName); method @NonNull public java.util.Set<java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String); method @NonNull public java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String); method public int getKeyguardDisabledFeatures(@Nullable android.content.ComponentName); method public int getLockTaskFeatures(@NonNull android.content.ComponentName); method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName);
core/java/android/app/admin/DevicePolicyManager.java +10 −22 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; Loading Loading @@ -6460,12 +6461,14 @@ public class DevicePolicyManager { * to a given KeyChain key. * * Key are granted on a per-UID basis, so if several apps share the same UID, granting access to * one of them automatically grants it to others. This method returns a set of sets of package * names, where each internal set contains all packages sharing the same UID. Grantee packages * that don't share UID with other packages are represented by singleton sets. * one of them automatically grants it to others. This method returns a map containing one entry * per grantee UID. Entries have UIDs as keys and sets of corresponding package names as values. * In particular, grantee packages that don't share UID with other packages are represented by * entries having singleton sets as values. * * @param alias The alias of the key to grant access to. * @return package names of apps that have access to a given key, grouped by UIDs * @return apps that have access to a given key, arranged in a map from UID to sets of * package names. * * @throws SecurityException if the caller is not a device owner, a profile owner or * delegated certificate chooser. Loading @@ -6473,26 +6476,11 @@ public class DevicePolicyManager { * * @see #grantKeyPairToApp(ComponentName, String, String) */ public @NonNull Set<Set<String>> getKeyPairGrants(@NonNull String alias) { public @NonNull Map<Integer, Set<String>> getKeyPairGrants(@NonNull String alias) { throwIfParentInstance("getKeyPairGrants"); try { // Set of sets is flattened into a null-separated list. final List<String> flattened = mService.getKeyPairGrants(mContext.getPackageName(), alias); final Set<Set<String>> result = new HashSet<>(); Set<String> pkgsForOneUid = new HashSet<>(); for (final String pkg : flattened) { if (pkg == null) { result.add(pkgsForOneUid); pkgsForOneUid = new HashSet<>(); } else { pkgsForOneUid.add(pkg); } } if (!pkgsForOneUid.isEmpty()) { result.add(pkgsForOneUid); } return result; // The result is wrapped into intermediate parcelable representation. return mService.getKeyPairGrants(mContext.getPackageName(), alias).getPackagesByUid(); } catch (RemoteException e) { e.rethrowFromSystemServer(); } Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package android.app.admin; import android.app.admin.NetworkEvent; import android.app.IApplicationThread; import android.app.IServiceConnection; import android.app.admin.ParcelableGranteeMap; import android.app.admin.StartInstallingUpdateCallback; import android.app.admin.SystemUpdateInfo; import android.app.admin.SystemUpdatePolicy; Loading Loading @@ -485,7 +486,7 @@ interface IDevicePolicyManager { boolean startViewCalendarEventInManagedProfile(String packageName, long eventId, long start, long end, boolean allDay, int flags); boolean setKeyGrantForApp(in ComponentName admin, String callerPackage, String alias, String packageName, boolean hasGrant); List<String> getKeyPairGrants(in String callerPackage, in String alias); ParcelableGranteeMap getKeyPairGrants(in String callerPackage, in String alias); boolean setKeyGrantToWifiAuth(String callerPackage, String alias, boolean hasGrant); boolean isKeyPairGrantedToWifiAuth(String callerPackage, String alias); Loading
core/java/android/app/admin/ParcelableGranteeMap.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; parcelable ParcelableGranteeMap; No newline at end of file
core/java/android/app/admin/ParcelableGranteeMap.java 0 → 100644 +85 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.admin; import android.annotation.NonNull; import android.os.Parcel; import android.os.Parcelable; import android.util.ArrayMap; import android.util.ArraySet; import java.util.Map; import java.util.Set; /** * Class for marshalling keypair grantees for a given KeyChain key via Binder. * * @hide */ public class ParcelableGranteeMap implements Parcelable { private final Map<Integer, Set<String>> mPackagesByUid; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(mPackagesByUid.size()); for (final Map.Entry<Integer, Set<String>> uidEntry : mPackagesByUid.entrySet()) { dest.writeInt(uidEntry.getKey()); dest.writeStringArray(uidEntry.getValue().toArray(new String[0])); } } public static final @NonNull Parcelable.Creator<ParcelableGranteeMap> CREATOR = new Parcelable.Creator<ParcelableGranteeMap>() { @Override public ParcelableGranteeMap createFromParcel(Parcel source) { final Map<Integer, Set<String>> packagesByUid = new ArrayMap<>(); final int numUids = source.readInt(); for (int i = 0; i < numUids; i++) { final int uid = source.readInt(); final String[] pkgs = source.readStringArray(); packagesByUid.put(uid, new ArraySet<>(pkgs)); } return new ParcelableGranteeMap(packagesByUid); } @Override public ParcelableGranteeMap[] newArray(int size) { return new ParcelableGranteeMap[size]; } }; /** * Creates an instance holding a reference (not a copy) to the given map. */ public ParcelableGranteeMap(@NonNull Map<Integer, Set<String>> packagesByUid) { mPackagesByUid = packagesByUid; } /** * Returns a reference (not a copy) to the stored map. */ @NonNull public Map<Integer, Set<String>> getPackagesByUid() { return mPackagesByUid; } }