Merge "Add Permission Indicator methods/classes to Test Api" into sc-dev
This commit is contained in:
@@ -233,6 +233,8 @@ package android.app {
|
|||||||
field public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME = "fg_service_state_settle_time";
|
field public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME = "fg_service_state_settle_time";
|
||||||
field public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
|
field public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
|
||||||
field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
|
field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
|
||||||
|
field public static final String OPSTR_PHONE_CALL_CAMERA = "android:phone_call_camera";
|
||||||
|
field public static final String OPSTR_PHONE_CALL_MICROPHONE = "android:phone_call_microphone";
|
||||||
field public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android:use_icc_auth_with_device_identifier";
|
field public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android:use_icc_auth_with_device_identifier";
|
||||||
field public static final int OP_COARSE_LOCATION = 0; // 0x0
|
field public static final int OP_COARSE_LOCATION = 0; // 0x0
|
||||||
field public static final int OP_RECORD_AUDIO = 27; // 0x1b
|
field public static final int OP_RECORD_AUDIO = 27; // 0x1b
|
||||||
@@ -1931,6 +1933,17 @@ package android.os.vibrator {
|
|||||||
|
|
||||||
package android.permission {
|
package android.permission {
|
||||||
|
|
||||||
|
public final class PermGroupUsage {
|
||||||
|
ctor public PermGroupUsage(@NonNull String, int, @NonNull String, long, boolean, boolean, @Nullable CharSequence);
|
||||||
|
method @Nullable public CharSequence getAttribution();
|
||||||
|
method public long getLastAccess();
|
||||||
|
method @NonNull public String getPackageName();
|
||||||
|
method @NonNull public String getPermGroupName();
|
||||||
|
method public int getUid();
|
||||||
|
method public boolean isActive();
|
||||||
|
method public boolean isPhoneCall();
|
||||||
|
}
|
||||||
|
|
||||||
public final class PermissionControllerManager {
|
public final class PermissionControllerManager {
|
||||||
method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void countPermissionApps(@NonNull java.util.List<java.lang.String>, int, @NonNull android.permission.PermissionControllerManager.OnCountPermissionAppsResultCallback, @Nullable android.os.Handler);
|
method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void countPermissionApps(@NonNull java.util.List<java.lang.String>, int, @NonNull android.permission.PermissionControllerManager.OnCountPermissionAppsResultCallback, @Nullable android.os.Handler);
|
||||||
method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void getAppPermissions(@NonNull String, @NonNull android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, @Nullable android.os.Handler);
|
method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void getAppPermissions(@NonNull String, @NonNull android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, @Nullable android.os.Handler);
|
||||||
@@ -1945,6 +1958,10 @@ package android.permission {
|
|||||||
method public void onGetAppPermissions(@NonNull java.util.List<android.permission.RuntimePermissionPresentationInfo>);
|
method public void onGetAppPermissions(@NonNull java.util.List<android.permission.RuntimePermissionPresentationInfo>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class PermissionManager {
|
||||||
|
method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.permission.PermGroupUsage> getIndicatorAppOpUsageData();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
package android.print {
|
package android.print {
|
||||||
|
|||||||
@@ -1561,12 +1561,14 @@ public class AppOpsManager {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public static final String OPSTR_PHONE_CALL_MICROPHONE = "android:phone_call_microphone";
|
public static final String OPSTR_PHONE_CALL_MICROPHONE = "android:phone_call_microphone";
|
||||||
/**
|
/**
|
||||||
* Phone call is using camera
|
* Phone call is using camera
|
||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public static final String OPSTR_PHONE_CALL_CAMERA = "android:phone_call_camera";
|
public static final String OPSTR_PHONE_CALL_CAMERA = "android:phone_call_camera";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package android.permission;
|
|||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.TestApi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the usage of a permission group by an app. Supports package name, user, permission
|
* Represents the usage of a permission group by an app. Supports package name, user, permission
|
||||||
@@ -26,6 +27,7 @@ import android.annotation.Nullable;
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
public final class PermGroupUsage {
|
public final class PermGroupUsage {
|
||||||
|
|
||||||
private final String mPackageName;
|
private final String mPackageName;
|
||||||
@@ -36,7 +38,19 @@ public final class PermGroupUsage {
|
|||||||
private final boolean mIsPhoneCall;
|
private final boolean mIsPhoneCall;
|
||||||
private final CharSequence mAttribution;
|
private final CharSequence mAttribution;
|
||||||
|
|
||||||
PermGroupUsage(@NonNull String packageName, int uid,
|
/**
|
||||||
|
*
|
||||||
|
* @param packageName The package name of the using app
|
||||||
|
* @param uid The uid of the using app
|
||||||
|
* @param permGroupName The name of the permission group being used
|
||||||
|
* @param lastAccess The time of last access
|
||||||
|
* @param isActive Whether this is active
|
||||||
|
* @param isPhoneCall Whether this is a usage by the phone
|
||||||
|
* @param attribution An optional string attribution to show
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
|
public PermGroupUsage(@NonNull String packageName, int uid,
|
||||||
@NonNull String permGroupName, long lastAccess, boolean isActive, boolean isPhoneCall,
|
@NonNull String permGroupName, long lastAccess, boolean isActive, boolean isPhoneCall,
|
||||||
@Nullable CharSequence attribution) {
|
@Nullable CharSequence attribution) {
|
||||||
this.mPackageName = packageName;
|
this.mPackageName = packageName;
|
||||||
@@ -48,30 +62,58 @@ public final class PermGroupUsage {
|
|||||||
this.mAttribution = attribution;
|
this.mAttribution = attribution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public @NonNull String getPackageName() {
|
public @NonNull String getPackageName() {
|
||||||
return mPackageName;
|
return mPackageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
return mUid;
|
return mUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public @NonNull String getPermGroupName() {
|
public @NonNull String getPermGroupName() {
|
||||||
return mPermGroupName;
|
return mPermGroupName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public long getLastAccess() {
|
public long getLastAccess() {
|
||||||
return mLastAccess;
|
return mLastAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return mIsActive;
|
return mIsActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public boolean isPhoneCall() {
|
public boolean isPhoneCall() {
|
||||||
return mIsPhoneCall;
|
return mIsPhoneCall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@TestApi
|
||||||
public @Nullable CharSequence getAttribution() {
|
public @Nullable CharSequence getAttribution() {
|
||||||
return mAttribution;
|
return mAttribution;
|
||||||
}
|
}
|
||||||
@@ -80,6 +122,7 @@ public final class PermGroupUsage {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this))
|
return getClass().getSimpleName() + "@" + Integer.toHexString(System.identityHashCode(this))
|
||||||
+ " packageName: " + mPackageName + ", UID: " + mUid + ", permGroup: "
|
+ " packageName: " + mPackageName + ", UID: " + mUid + ", permGroup: "
|
||||||
+ mPermGroupName + ", isActive: " + mIsActive + ", attribution: " + mAttribution;
|
+ mPermGroupName + ", lastAccess: " + mLastAccess + ", isActive: " + mIsActive
|
||||||
|
+ ", attribution: " + mAttribution;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.annotation.Nullable;
|
|||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.annotation.SystemService;
|
import android.annotation.SystemService;
|
||||||
|
import android.annotation.TestApi;
|
||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityThread;
|
import android.app.ActivityThread;
|
||||||
@@ -851,6 +852,7 @@ public final class PermissionManager {
|
|||||||
*
|
*
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
|
@TestApi
|
||||||
@NonNull
|
@NonNull
|
||||||
@RequiresPermission(Manifest.permission.GET_APP_OPS_STATS)
|
@RequiresPermission(Manifest.permission.GET_APP_OPS_STATS)
|
||||||
public List<PermGroupUsage> getIndicatorAppOpUsageData() {
|
public List<PermGroupUsage> getIndicatorAppOpUsageData() {
|
||||||
|
|||||||
@@ -71,13 +71,10 @@ public class PermissionUsageHelper {
|
|||||||
private static final String PROPERTY_PERMISSIONS_HUB_2_ENABLED = "permissions_hub_2_enabled";
|
private static final String PROPERTY_PERMISSIONS_HUB_2_ENABLED = "permissions_hub_2_enabled";
|
||||||
|
|
||||||
/** How long after an access to show it as "recent" */
|
/** How long after an access to show it as "recent" */
|
||||||
private static final String RECENT_ACCESS_TIME_MS = "recent_acccess_time_ms";
|
private static final String RECENT_ACCESS_TIME_MS = "recent_access_time_ms";
|
||||||
|
|
||||||
/** How long after an access to show it as "running" */
|
/** How long after an access to show it as "running" */
|
||||||
private static final String RUNNING_ACCESS_TIME_MS = "running_acccess_time_ms";
|
private static final String RUNNING_ACCESS_TIME_MS = "running_access_time_ms";
|
||||||
|
|
||||||
/** The name of the expected voice IME subtype */
|
|
||||||
private static final String VOICE_IME_SUBTYPE = "voice";
|
|
||||||
|
|
||||||
private static final String SYSTEM_PKG = "android";
|
private static final String SYSTEM_PKG = "android";
|
||||||
|
|
||||||
@@ -279,6 +276,10 @@ public class PermissionUsageHelper {
|
|||||||
opEntry.getAttributedOpEntries().get(attributionTag);
|
opEntry.getAttributedOpEntries().get(attributionTag);
|
||||||
|
|
||||||
long lastAccessTime = attrOpEntry.getLastAccessTime(opFlags);
|
long lastAccessTime = attrOpEntry.getLastAccessTime(opFlags);
|
||||||
|
if (attrOpEntry.isRunning()) {
|
||||||
|
lastAccessTime = now;
|
||||||
|
}
|
||||||
|
|
||||||
if (lastAccessTime < recentThreshold && !attrOpEntry.isRunning()) {
|
if (lastAccessTime < recentThreshold && !attrOpEntry.isRunning()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user