Merge "Adds a config for default autofill service." into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
045c71f1be
@@ -2822,4 +2822,11 @@
|
|||||||
|
|
||||||
<!-- Whether the device supports quick settings and its associated APIs -->
|
<!-- Whether the device supports quick settings and its associated APIs -->
|
||||||
<bool name="config_quickSettingsSupported">true</bool>
|
<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>
|
</resources>
|
||||||
|
|||||||
@@ -2944,6 +2944,7 @@
|
|||||||
<java-symbol type="string" name="notification_channel_alerts" />
|
<java-symbol type="string" name="notification_channel_alerts" />
|
||||||
<java-symbol type="string" name="notification_channel_retail_mode" />
|
<java-symbol type="string" name="notification_channel_retail_mode" />
|
||||||
<java-symbol type="string" name="notification_channel_usb" />
|
<java-symbol type="string" name="notification_channel_usb" />
|
||||||
|
<java-symbol type="string" name="config_defaultAutofillService" />
|
||||||
|
|
||||||
<!-- ETWS primary messages -->
|
<!-- ETWS primary messages -->
|
||||||
<java-symbol type="string" name="etws_primary_default_message_earthquake" />
|
<java-symbol type="string" name="etws_primary_default_message_earthquake" />
|
||||||
|
|||||||
@@ -2798,7 +2798,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class UpgradeController {
|
private final class UpgradeController {
|
||||||
private static final int SETTINGS_VERSION = 143;
|
private static final int SETTINGS_VERSION = 144;
|
||||||
|
|
||||||
private final int mUserId;
|
private final int mUserId;
|
||||||
|
|
||||||
@@ -3324,7 +3324,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentVersion == 141) {
|
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
|
// 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
|
// to make sure this value is updated for the existing settings, otherwise
|
||||||
// we would delete system set settings while they should stay unmodified.
|
// we would delete system set settings while they should stay unmodified.
|
||||||
@@ -3344,7 +3344,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentVersion == 142) {
|
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) {
|
if (userId == UserHandle.USER_SYSTEM) {
|
||||||
final SettingsState globalSettings = getGlobalSettingsLocked();
|
final SettingsState globalSettings = getGlobalSettingsLocked();
|
||||||
Setting currentSetting = globalSettings.getSettingLocked(
|
Setting currentSetting = globalSettings.getSettingLocked(
|
||||||
@@ -3361,6 +3361,27 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
currentVersion = 143;
|
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) {
|
if (currentVersion != newVersion) {
|
||||||
Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
|
Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
|
||||||
+ newVersion + " left it at "
|
+ 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 the current version.
|
||||||
return currentVersion;
|
return currentVersion;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.VERBOSE;
|
||||||
import static com.android.server.autofill.Helper.bundleToString;
|
import static com.android.server.autofill.Helper.bundleToString;
|
||||||
|
|
||||||
import android.Manifest;
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.ActivityManagerInternal;
|
import android.app.ActivityManagerInternal;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -36,7 +35,6 @@ import android.content.pm.UserInfo;
|
|||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ import android.view.autofill.AutofillId;
|
|||||||
import android.view.autofill.AutofillValue;
|
import android.view.autofill.AutofillValue;
|
||||||
import android.view.autofill.IAutoFillManagerClient;
|
import android.view.autofill.IAutoFillManagerClient;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.os.HandlerCaller;
|
import com.android.internal.os.HandlerCaller;
|
||||||
import com.android.internal.os.IResultReceiver;
|
import com.android.internal.os.IResultReceiver;
|
||||||
@@ -431,8 +432,11 @@ final class AutofillManagerServiceImpl {
|
|||||||
void dumpLocked(String prefix, PrintWriter pw) {
|
void dumpLocked(String prefix, PrintWriter pw) {
|
||||||
final String prefix2 = prefix + " ";
|
final String prefix2 = prefix + " ";
|
||||||
|
|
||||||
|
pw.print(prefix); pw.print("User :"); pw.println(mUserId);
|
||||||
pw.print(prefix); pw.print("Component:"); pw.println(mInfo != null
|
pw.print(prefix); pw.print("Component:"); pw.println(mInfo != null
|
||||||
? mInfo.getServiceInfo().getComponentName() : 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);
|
pw.print(prefix); pw.print("Disabled:"); pw.println(mDisabled);
|
||||||
|
|
||||||
if (VERBOSE && mInfo != null) {
|
if (VERBOSE && mInfo != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user