Loading core/java/android/service/autofill/AutofillServiceInfo.java +8 −2 Original line number Diff line number Diff line Loading @@ -29,11 +29,12 @@ import android.os.RemoteException; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import com.android.internal.R; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; /** Loading Loading @@ -147,4 +148,9 @@ public final class AutofillServiceInfo { public String getSettingsActivity() { return mSettingsActivity; } @Override public String toString() { return mServiceInfo == null ? "null" : mServiceInfo.toString(); } } proto/src/metrics_constants.proto +5 −0 Original line number Diff line number Diff line Loading @@ -4527,6 +4527,11 @@ message MetricsEvent { // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; // Autofill service called API that disables itself // Package: Package of the autofill service // OS: O MR AUTOFILL_SERVICE_DISABLED_SELF = 1135; // ---- End O-MR1 Constants, all O-MR1 constants go above this line ---- // Add new aosp constants above this line. Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +23 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.metrics.LogMaker; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -63,6 +64,8 @@ import android.view.autofill.IAutoFillManagerClient; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.os.HandlerCaller; import com.android.server.autofill.ui.AutoFillUI; Loading @@ -89,6 +92,7 @@ final class AutofillManagerServiceImpl { private final Context mContext; private final Object mLock; private final AutoFillUI mUi; private final MetricsLogger mMetricsLogger = new MetricsLogger(); private RemoteCallbackList<IAutoFillManagerClient> mClients; private AutofillServiceInfo mInfo; Loading Loading @@ -218,8 +222,10 @@ final class AutofillManagerServiceImpl { if (serviceInfo != null) { mInfo = new AutofillServiceInfo(mContext.getPackageManager(), serviceComponent, mUserId); if (sDebug) Slog.d(TAG, "Set component for user " + mUserId + " as " + mInfo); } else { mInfo = null; if (sDebug) Slog.d(TAG, "Reset component for user " + mUserId); } final boolean isEnabled = isEnabled(); if (wasEnabled != isEnabled) { Loading Loading @@ -345,17 +351,31 @@ final class AutofillManagerServiceImpl { } void disableOwnedAutofillServicesLocked(int uid) { if (mInfo == null || mInfo.getServiceInfo().applicationInfo.uid != uid) { Slog.i(TAG, "disableOwnedServices(" + uid + "): " + mInfo); if (mInfo == null) return; final ServiceInfo serviceInfo = mInfo.getServiceInfo(); if (serviceInfo.applicationInfo.uid != uid) { Slog.w(TAG, "disableOwnedServices(): ignored when called by UID " + uid + " instead of " + serviceInfo.applicationInfo.uid + " for service " + mInfo); return; } final long identity = Binder.clearCallingIdentity(); try { final String autoFillService = getComponentNameFromSettings(); if (mInfo.getServiceInfo().getComponentName().equals( ComponentName.unflattenFromString(autoFillService))) { final ComponentName componentName = serviceInfo.getComponentName(); if (componentName.equals(ComponentName.unflattenFromString(autoFillService))) { mMetricsLogger.action(MetricsEvent.AUTOFILL_SERVICE_DISABLED_SELF, componentName.getPackageName()); Settings.Secure.putStringForUser(mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, null, mUserId); destroySessionsLocked(); } else { Slog.w(TAG, "disableOwnedServices(): ignored because current service (" + serviceInfo + ") does not match Settings (" + autoFillService + ")"); } } finally { Binder.restoreCallingIdentity(identity); Loading Loading
core/java/android/service/autofill/AutofillServiceInfo.java +8 −2 Original line number Diff line number Diff line Loading @@ -29,11 +29,12 @@ import android.os.RemoteException; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import com.android.internal.R; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; /** Loading Loading @@ -147,4 +148,9 @@ public final class AutofillServiceInfo { public String getSettingsActivity() { return mSettingsActivity; } @Override public String toString() { return mServiceInfo == null ? "null" : mServiceInfo.toString(); } }
proto/src/metrics_constants.proto +5 −0 Original line number Diff line number Diff line Loading @@ -4527,6 +4527,11 @@ message MetricsEvent { // Type TYPE_FAILURE: An invalid opperation was reported by the app's AutofillManager AUTOFILL_PENDING_SAVE_UI_OPERATION = 1134; // Autofill service called API that disables itself // Package: Package of the autofill service // OS: O MR AUTOFILL_SERVICE_DISABLED_SELF = 1135; // ---- End O-MR1 Constants, all O-MR1 constants go above this line ---- // Add new aosp constants above this line. Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +23 −3 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.metrics.LogMaker; import android.os.AsyncTask; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -63,6 +64,8 @@ import android.view.autofill.IAutoFillManagerClient; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.os.HandlerCaller; import com.android.server.autofill.ui.AutoFillUI; Loading @@ -89,6 +92,7 @@ final class AutofillManagerServiceImpl { private final Context mContext; private final Object mLock; private final AutoFillUI mUi; private final MetricsLogger mMetricsLogger = new MetricsLogger(); private RemoteCallbackList<IAutoFillManagerClient> mClients; private AutofillServiceInfo mInfo; Loading Loading @@ -218,8 +222,10 @@ final class AutofillManagerServiceImpl { if (serviceInfo != null) { mInfo = new AutofillServiceInfo(mContext.getPackageManager(), serviceComponent, mUserId); if (sDebug) Slog.d(TAG, "Set component for user " + mUserId + " as " + mInfo); } else { mInfo = null; if (sDebug) Slog.d(TAG, "Reset component for user " + mUserId); } final boolean isEnabled = isEnabled(); if (wasEnabled != isEnabled) { Loading Loading @@ -345,17 +351,31 @@ final class AutofillManagerServiceImpl { } void disableOwnedAutofillServicesLocked(int uid) { if (mInfo == null || mInfo.getServiceInfo().applicationInfo.uid != uid) { Slog.i(TAG, "disableOwnedServices(" + uid + "): " + mInfo); if (mInfo == null) return; final ServiceInfo serviceInfo = mInfo.getServiceInfo(); if (serviceInfo.applicationInfo.uid != uid) { Slog.w(TAG, "disableOwnedServices(): ignored when called by UID " + uid + " instead of " + serviceInfo.applicationInfo.uid + " for service " + mInfo); return; } final long identity = Binder.clearCallingIdentity(); try { final String autoFillService = getComponentNameFromSettings(); if (mInfo.getServiceInfo().getComponentName().equals( ComponentName.unflattenFromString(autoFillService))) { final ComponentName componentName = serviceInfo.getComponentName(); if (componentName.equals(ComponentName.unflattenFromString(autoFillService))) { mMetricsLogger.action(MetricsEvent.AUTOFILL_SERVICE_DISABLED_SELF, componentName.getPackageName()); Settings.Secure.putStringForUser(mContext.getContentResolver(), Settings.Secure.AUTOFILL_SERVICE, null, mUserId); destroySessionsLocked(); } else { Slog.w(TAG, "disableOwnedServices(): ignored because current service (" + serviceInfo + ") does not match Settings (" + autoFillService + ")"); } } finally { Binder.restoreCallingIdentity(identity); Loading