Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/api/system-current.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4380,6 +4380,7 @@ package android.content.pm {

public interface GosPackageStateFlag {
field public static final int CONTACT_SCOPES_ENABLED = 5; // 0x5
field public static final int HIDE_LOCATION_INDICATOR = 29; // 0x1d
field public static final int STORAGE_SCOPES_ENABLED = 0; // 0x0
}

Expand Down
2 changes: 2 additions & 0 deletions core/java/android/content/pm/GosPackageStateFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public interface GosPackageStateFlag {
/** @hide */ int PLAY_INTEGRITY_API_USED_AT_LEAST_ONCE = 26;
/** @hide */ int SUPPRESS_PLAY_INTEGRITY_API_NOTIF = 27;
/** @hide */ int BLOCK_PLAY_INTEGRITY_API = 28;
/* SysApi */ int HIDE_LOCATION_INDICATOR = 29;

/** @hide */
@IntDef(value = {
Expand Down Expand Up @@ -64,6 +65,7 @@ public interface GosPackageStateFlag {
PLAY_INTEGRITY_API_USED_AT_LEAST_ONCE,
SUPPRESS_PLAY_INTEGRITY_API_NOTIF,
BLOCK_PLAY_INTEGRITY_API,
HIDE_LOCATION_INDICATOR,
})
@Retention(RetentionPolicy.SOURCE)
@interface Enum {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import com.android.systemui.util.concurrency.DelayableExecutor
import com.android.systemui.util.withIncreasedIndent
import java.io.PrintWriter
import javax.inject.Inject
import android.content.pm.GosPackageState
import android.content.pm.GosPackageStateFlag

/**
* Monitors privacy items backed by app ops:
Expand Down Expand Up @@ -430,11 +432,14 @@ constructor(
if (result) {
synchronized(lock) { hasNonSystemForegroundLocationAccess = true }
}
return result
// must return false when HIDE_LOCATION_INDICATOR flag is set
// this hides the location indicator (green dot) without preventing logging of location access
return result && !isHideLocationIndicatorFlagSet(item)
}
if (item.code == AppOpsManager.OP_MONITOR_HIGH_POWER_LOCATION) {
synchronized(lock) { hasHighPowerLocationAccess = true }
}
// dont need to check hide location indicator as it only shows for fine location access
return true
}

Expand Down Expand Up @@ -498,6 +503,16 @@ constructor(
return false
}

private fun isHideLocationIndicatorFlagSet(item: AppOpItem): Boolean {
try {
val userId = UserHandle.getUserId(item.uid)
val packageState = GosPackageState.get(item.packageName, userId)
return packageState.hasFlag(GosPackageStateFlag.HIDE_LOCATION_INDICATOR)
} catch (_: Exception) {
return false
}
}

override fun dump(pw: PrintWriter, args: Array<out String>) {
val ipw = pw.asIndenting()
ipw.println("AppOpsPrivacyItemMonitor:")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static android.content.pm.GosPackageStateFlag.BLOCK_PLAY_INTEGRITY_API;
import static android.content.pm.GosPackageStateFlag.CONTACT_SCOPES_ENABLED;
import static android.content.pm.GosPackageStateFlag.ENABLE_EXPLOIT_PROTECTION_COMPAT_MODE;
import static android.content.pm.GosPackageStateFlag.HIDE_LOCATION_INDICATOR;
import static android.content.pm.GosPackageStateFlag.FORCE_MEMTAG;
import static android.content.pm.GosPackageStateFlag.FORCE_MEMTAG_NON_DEFAULT;
import static android.content.pm.GosPackageStateFlag.FORCE_MEMTAG_SUPPRESS_NOTIF;
Expand Down Expand Up @@ -108,7 +109,7 @@ static void init(PackageManagerService pm) {
.crossUserPermission(ALLOW_CROSS_USER_PROFILE_READS)
.apply(ksp.launcher, computer);
builder()
.readWriteFlags(STORAGE_SCOPES_ENABLED, CONTACT_SCOPES_ENABLED)
.readWriteFlags(STORAGE_SCOPES_ENABLED, CONTACT_SCOPES_ENABLED, HIDE_LOCATION_INDICATOR)
.readWriteFields(FIELD_STORAGE_SCOPES, FIELD_CONTACT_SCOPES,
FIELD_PACKAGE_FLAGS)
// in some cases PermissionController handles user profile from profile parent user
Expand All @@ -118,6 +119,9 @@ static void init(PackageManagerService pm) {
.readFlags(playIntegrityFlags)
.readWriteFlag(SUPPRESS_PLAY_INTEGRITY_API_NOTIF)
.apply(GmsCompatApp.PKG_NAME, computer);
builder()
.readFlags(HIDE_LOCATION_INDICATOR)
.apply(ksp.systemUi, computer);

@GosPackageStateFlag.Enum int[] settingsReadWriteFlags = {
ALLOW_ACCESS_TO_OBB_DIRECTORY,
Expand Down