Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87440e9c authored by Felipe Leme's avatar Felipe Leme Committed by android-build-merger
Browse files

Merge "Adds a config for default autofill service." into oc-dev

am: 045c71f1

Change-Id: I3f92aff715d9a9a9e7d2c96f6eb60f7b86e9b9d3
parents 63f2ec78 045c71f1
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2822,4 +2822,11 @@

    <!-- Whether the device supports quick settings and its associated APIs -->
    <bool name="config_quickSettingsSupported">true</bool>

    <!-- The component name, flattened to a string, for the default autofill service
         to  enabled for an user. This service must be trusted, as it can be activated
         without explicit consent of the user. If no autofill service with the
          specified name exists on the device, autofill will be disabled by default.
    -->
    <string name="config_defaultAutofillService" translatable="false"></string>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -2944,6 +2944,7 @@
  <java-symbol type="string" name="notification_channel_alerts" />
  <java-symbol type="string" name="notification_channel_retail_mode" />
  <java-symbol type="string" name="notification_channel_usb" />
  <java-symbol type="string" name="config_defaultAutofillService" />

  <!-- ETWS primary messages -->
  <java-symbol type="string" name="etws_primary_default_message_earthquake" />
+24 −5
Original line number Diff line number Diff line
@@ -2798,7 +2798,7 @@ public class SettingsProvider extends ContentProvider {
        }

        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 143;
            private static final int SETTINGS_VERSION = 144;

            private final int mUserId;

@@ -3324,7 +3324,7 @@ public class SettingsProvider extends ContentProvider {
                }

                if (currentVersion == 141) {
                    // Version 141: We added the notion of a default and whether the system set
                    // Version 142: We added the notion of a default and whether the system set
                    // the setting. This is used for resetting the internal state and we need
                    // to make sure this value is updated for the existing settings, otherwise
                    // we would delete system set settings while they should stay unmodified.
@@ -3344,7 +3344,7 @@ public class SettingsProvider extends ContentProvider {
                }

                if (currentVersion == 142) {
                    // Version 142: Set a default value for Wi-Fi wakeup feature.
                    // Version 143: Set a default value for Wi-Fi wakeup feature.
                    if (userId == UserHandle.USER_SYSTEM) {
                        final SettingsState globalSettings = getGlobalSettingsLocked();
                        Setting currentSetting = globalSettings.getSettingLocked(
@@ -3361,6 +3361,27 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 143;
                }

                if (currentVersion == 143) {
                    // Version 144: Set a default value for Autofill service.
                    final SettingsState secureSettings = getSecureSettingsLocked(userId);
                    final Setting currentSetting = secureSettings
                            .getSettingLocked(Settings.Secure.AUTOFILL_SERVICE);
                    if (currentSetting.isNull()) {
                        final String defaultValue = getContext().getResources().getString(
                                com.android.internal.R.string.config_defaultAutofillService);
                        if (defaultValue != null) {
                            Slog.d(LOG_TAG, "Setting [" + defaultValue + "] as Autofill Service "
                                    + "for user " + userId);
                            secureSettings.insertSettingLocked(Settings.Secure.AUTOFILL_SERVICE,
                                    defaultValue, null, true, SettingsState.SYSTEM_PACKAGE_NAME);
                        }
                    }

                    currentVersion = 144;
                }

                // vXXX: Add new settings above this point.

                if (currentVersion != newVersion) {
                    Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
                            + newVersion + " left it at "
@@ -3372,8 +3393,6 @@ public class SettingsProvider extends ContentProvider {
                    }
                }

                // vXXX: Add new settings above this point.

                // Return the current version.
                return currentVersion;
            }
+0 −2
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static com.android.server.autofill.Helper.DEBUG;
import static com.android.server.autofill.Helper.VERBOSE;
import static com.android.server.autofill.Helper.bundleToString;

import android.Manifest;
import android.annotation.NonNull;
import android.app.ActivityManagerInternal;
import android.content.BroadcastReceiver;
@@ -36,7 +35,6 @@ import android.content.pm.UserInfo;
import android.database.ContentObserver;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
+4 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.view.autofill.AutofillId;
import android.view.autofill.AutofillValue;
import android.view.autofill.IAutoFillManagerClient;

import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.os.HandlerCaller;
import com.android.internal.os.IResultReceiver;
@@ -431,8 +432,11 @@ final class AutofillManagerServiceImpl {
    void dumpLocked(String prefix, PrintWriter pw) {
        final String prefix2 = prefix + "  ";

        pw.print(prefix); pw.print("User :"); pw.println(mUserId);
        pw.print(prefix); pw.print("Component:"); pw.println(mInfo != null
                ? mInfo.getServiceInfo().getComponentName() : null);
        pw.print(prefix); pw.print("Default component: ");
            pw.println(mContext.getString(R.string.config_defaultAutofillService));
        pw.print(prefix); pw.print("Disabled:"); pw.println(mDisabled);

        if (VERBOSE && mInfo != null) {