diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-26 19:14:28 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-26 19:14:28 +0000 |
commit | dda266621a00ebf97195cfc00b4da0c4a264c4de (patch) | |
tree | 712682380b879d19b99f3b90f6c866d4f56b90b2 | |
parent | b80cf4791b565518d849818d12d7b229afd23075 (diff) | |
parent | b6494a9ad6ac9d5d05713dca10ff282f11187d48 (diff) | |
download | base-dda266621a00ebf97195cfc00b4da0c4a264c4de.tar.gz |
Merge cherrypicks of [3519487, 3519488, 3520743, 3521264, 3521265] into oc-m2-release
Change-Id: I890e0abea705523c9dc9c38818a74b6d0a939a61
5 files changed, 36 insertions, 26 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 2c04f8ff9548..8dc558ccf755 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -5872,6 +5872,16 @@ public class Activity extends ContextThemeWrapper } /** + * Temporary method on O-MR1 only. + * + * @hide + */ + @Override + public ComponentName getComponentNameForAutofill() { + return mComponent; + } + + /** * Retrieve a {@link SharedPreferences} object for accessing preferences * that are private to this activity. This simply calls the underlying * {@link #getSharedPreferences(String, int)} method by passing in this activity's diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index ba738b6dfcea..fb9534b2e52e 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -24,7 +24,6 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; -import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -387,6 +386,13 @@ public final class AutofillManager { * Runs the specified action on the UI thread. */ void runOnUiThread(Runnable action); + + /** + * Gets the complete component name of this client. + * + * <p>Temporary method on O-MR1 only. + */ + ComponentName getComponentNameForAutofill(); } /** @@ -943,11 +949,8 @@ public final class AutofillManager { return mContext.getAutofillClient(); } - private ComponentName getComponentNameFromContext() { - if (mContext instanceof Activity) { - return ((Activity) mContext).getComponentName(); - } - return null; + private ComponentName getComponentNameFromContext(AutofillClient client) { + return client == null ? null : client.getComponentNameForAutofill(); } /** @hide */ @@ -1000,7 +1003,8 @@ public final class AutofillManager { return; } try { - final ComponentName componentName = getComponentNameFromContext(); + final AutofillClient client = getClientLocked(); + final ComponentName componentName = getComponentNameFromContext(client); if (componentName == null) { Log.w(TAG, "startSessionLocked(): context is not activity: " + mContext); return; @@ -1011,7 +1015,6 @@ public final class AutofillManager { if (mSessionId != NO_SESSION) { mState = STATE_ACTIVE; } - final AutofillClient client = getClientLocked(); if (client != null) { client.autofillCallbackResetableStateAvailable(); } @@ -1065,7 +1068,8 @@ public final class AutofillManager { try { if (restartIfNecessary) { - final ComponentName componentName = getComponentNameFromContext(); + final AutofillClient client = getClientLocked(); + final ComponentName componentName = getComponentNameFromContext(client); if (componentName == null) { Log.w(TAG, "startSessionLocked(): context is not activity: " + mContext); return; @@ -1077,7 +1081,6 @@ public final class AutofillManager { if (sDebug) Log.d(TAG, "Session restarted: " + mSessionId + "=>" + newId); mSessionId = newId; mState = (mSessionId == NO_SESSION) ? STATE_UNKNOWN : STATE_ACTIVE; - final AutofillClient client = getClientLocked(); if (client != null) { client.autofillCallbackResetableStateAvailable(); } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 7d7f9ae7f19e..04be92e73b38 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -1687,18 +1687,9 @@ public class SettingsProvider extends ContentProvider { } private List<String> getSettingsNamesLocked(int settingsType, int userId) { - boolean instantApp; - if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) { - instantApp = false; - } else { - ApplicationInfo ai = getCallingApplicationInfoOrThrow(); - instantApp = ai.isInstantApp(); - } - if (instantApp) { - return new ArrayList<String>(getInstantAppAccessibleSettings(settingsType)); - } else { - return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId); - } + // Don't enforce the instant app whitelist for now -- its too prone to unintended breakage + // in the current form. + return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId); } private void enforceSettingReadable(String settingName, int settingsType, int userId) { @@ -1711,8 +1702,10 @@ public class SettingsProvider extends ContentProvider { } if (!getInstantAppAccessibleSettings(settingsType).contains(settingName) && !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) { - throw new SecurityException("Setting " + settingName + " is not accessible from" - + " ephemeral package " + getCallingPackage()); + // Don't enforce the instant app whitelist for now -- its too prone to unintended + // breakage in the current form. + Slog.w(LOG_TAG, "Instant App " + ai.packageName + + " trying to access unexposed setting, this will be an error in the future."); } } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index 28f26c6fa55b..3cadff242e03 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -4545,7 +4545,8 @@ message MetricsEvent { // OS: O MR AUTOFILL_SERVICE_DISABLED_SELF = 1135; - // Counter showing how long it took (in ms) to show the autofill UI after a field was focused + // Reports how long it took to show the autofill UI after a field was focused + // Tag FIELD_AUTOFILL_DURATION: Duration in ms // Tag FIELD_AUTOFILL_SERVICE: Package of service that processed the request // Package: Package of the autofill service // OS: O MR @@ -4584,6 +4585,9 @@ message MetricsEvent { // logged when we cancel an app transition. APP_TRANSITION_CANCELLED = 1144; + // Tag of a field representing a duration on autofill-related metrics. + FIELD_AUTOFILL_DURATION = 1145; + // ---- End O-MR1 Constants, all O-MR1 constants go above this line ---- // ACTION: Stop an app and turn on background check diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index c5cf970eab79..1f0e51c694aa 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -1397,7 +1397,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mUiLatencyHistory.log(historyLog.toString()); final LogMaker metricsLog = newLogMaker(MetricsEvent.AUTOFILL_UI_LATENCY) - .setCounterValue((int) duration); + .addTaggedData(MetricsEvent.FIELD_AUTOFILL_DURATION, duration); mMetricsLogger.write(metricsLog); } } |