diff options
| author | 2021-03-22 11:27:43 -0700 | |
|---|---|---|
| committer | 2021-03-22 15:00:51 -0700 | |
| commit | 1dc7b05ca352740e8f759e4750de4a26f3efe702 (patch) | |
| tree | 867510df5dd2ea73e85dab11a3b391d5a8765455 /location/java | |
| parent | 2c946706faf3159b93f8f3abbf4114e73c7e8235 (diff) | |
Fix logging bugs
Adds additional logging around user switches, and fixes a bug where
location toggle changes were not logged correctly.
Bug: 183409327
Test: manual
Change-Id: I36fdef5c3eddd3db70d7c18506f82bb687677120
Diffstat (limited to 'location/java')
| -rw-r--r-- | location/java/android/location/util/identity/CallerIdentity.java | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/location/java/android/location/util/identity/CallerIdentity.java b/location/java/android/location/util/identity/CallerIdentity.java index 85a083ee84bc..ade0ea40e157 100644 --- a/location/java/android/location/util/identity/CallerIdentity.java +++ b/location/java/android/location/util/identity/CallerIdentity.java @@ -55,6 +55,20 @@ public final class CallerIdentity { } /** + * Returns a CallerIdentity with PID and listener ID information stripped. This is mostly + * useful for aggregating information for debug purposes, and should not be used in any API with + * security requirements. + */ + public static CallerIdentity forAggregation(CallerIdentity callerIdentity) { + if (callerIdentity.getPid() == 0 && callerIdentity.getListenerId() == null) { + return callerIdentity; + } + + return new CallerIdentity(callerIdentity.getUid(), 0, callerIdentity.getPackageName(), + callerIdentity.getAttributionTag(), null); + } + + /** * Creates a CallerIdentity for the current process and context. */ public static CallerIdentity fromContext(Context context) { @@ -180,17 +194,6 @@ public final class CallerIdentity { } } - /** - * Returns a CallerIdentity corrosponding to this CallerIdentity but with a null listener id. - */ - public CallerIdentity stripListenerId() { - if (mListenerId == null) { - return this; - } else { - return new CallerIdentity(mUid, mPid, mPackageName, mAttributionTag, null); - } - } - @Override public String toString() { int length = 10 + mPackageName.length(); |