Loading services/autofill/java/com/android/server/autofill/AutofillManagerService.java +21 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.Context.AUTOFILL_MANAGER_SERVICE; import static com.android.server.autofill.Helper.bundleToString; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sFullScreenMode; import static com.android.server.autofill.Helper.sPartitionMaxCount; import static com.android.server.autofill.Helper.sVisibleDatasetsMaxCount; import static com.android.server.autofill.Helper.sVerbose; Loading Loading @@ -449,7 +450,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public int getMaxPartitions() { int getMaxPartitions() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); synchronized (mLock) { Loading @@ -458,7 +459,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void setMaxPartitions(int max) { void setMaxPartitions(int max) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Slog.i(TAG, "setMaxPartitions(): " + max); synchronized (mLock) { Loading @@ -467,7 +468,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public int getMaxVisibleDatasets() { int getMaxVisibleDatasets() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); synchronized (mLock) { Loading @@ -476,7 +477,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void setMaxVisibleDatasets(int max) { void setMaxVisibleDatasets(int max) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Slog.i(TAG, "setMaxVisibleDatasets(): " + max); synchronized (mLock) { Loading @@ -485,7 +486,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void getScore(@Nullable String algorithmName, @NonNull String value1, void getScore(@Nullable String algorithmName, @NonNull String value1, @NonNull String value2, @NonNull RemoteCallback callback) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Loading @@ -496,6 +497,18 @@ public final class AutofillManagerService extends SystemService { Arrays.asList(AutofillValue.forText(value1)), new String[] { value2 }); } // Called by Shell command. Boolean getFullScreenMode() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); return sFullScreenMode; } // Called by Shell command. void setFullScreenMode(@Nullable Boolean mode) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); sFullScreenMode = mode; } private void setDebugLocked(boolean debug) { com.android.server.autofill.Helper.sDebug = debug; android.view.autofill.Helper.sDebug = debug; Loading Loading @@ -1159,6 +1172,9 @@ public final class AutofillManagerService extends SystemService { pw.print("Disabled users: "); pw.println(mDisabledUsers); pw.print("Max partitions per session: "); pw.println(sPartitionMaxCount); pw.print("Max visible datasets: "); pw.println(sVisibleDatasetsMaxCount); if (sFullScreenMode != null) { pw.print("Overridden full-screen mode: "); pw.println(sFullScreenMode); } pw.println("User data constraints: "); UserData.dumpConstraints(prefix, pw); final int size = mServicesCache.size(); pw.print("Cached services: "); Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java +43 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,12 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" get max_visible_datasets"); pw.println(" Gets the maximum number of visible datasets in the UI."); pw.println(""); pw.println(" get full_screen_mode"); pw.println(" Gets the Fill UI full screen mode"); pw.println(""); pw.println(" get fc_score [--algorithm ALGORITHM] value1 value2"); pw.println(" Gets the field classification score for 2 fields."); pw.println(""); pw.println(" set log_level [off | debug | verbose]"); pw.println(" Sets the Autofill log level."); pw.println(""); Loading @@ -89,6 +95,9 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" set max_visible_datasets number"); pw.println(" Sets the maximum number of visible datasets in the UI."); pw.println(""); pw.println(" set full_screen_mode [true | false | default]"); pw.println(" Sets the Fill UI full screen mode"); pw.println(""); pw.println(" list sessions [--user USER_ID]"); pw.println(" Lists all pending sessions."); pw.println(""); Loading @@ -98,9 +107,6 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" reset"); pw.println(" Resets all pending sessions and cached service connections."); pw.println(""); pw.println(" get fc_score [--algorithm ALGORITHM] value1 value2"); pw.println(" Gets the field classification score for 2 fields."); pw.println(""); } } Loading @@ -115,6 +121,8 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return getMaxVisibileDatasets(pw); case "fc_score": return getFieldClassificationScore(pw); case "full_screen_mode": return getFullScreenMode(pw); default: pw.println("Invalid set: " + what); return -1; Loading @@ -131,6 +139,8 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return setMaxPartitions(); case "max_visible_datasets": return setMaxVisibileDatasets(); case "full_screen_mode": return setFullScreenMode(pw); default: pw.println("Invalid set: " + what); return -1; Loading Loading @@ -219,6 +229,36 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return waitForLatch(pw, latch); } private int getFullScreenMode(PrintWriter pw) { final Boolean mode = mService.getFullScreenMode(); if (mode == null) { pw.println("default"); } else if (mode) { pw.println("true"); } else { pw.println("false"); } return 0; } private int setFullScreenMode(PrintWriter pw) { final String mode = getNextArgRequired(); switch (mode.toLowerCase()) { case "true": mService.setFullScreenMode(Boolean.TRUE); return 0; case "false": mService.setFullScreenMode(Boolean.FALSE); return 0; case "default": mService.setFullScreenMode(null); return 0; default: pw.println("Invalid mode: " + mode); return -1; } } private int requestDestroy(PrintWriter pw) { if (!isNextArgSessions(pw)) { return -1; Loading services/autofill/java/com/android/server/autofill/Helper.java +5 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,11 @@ public final class Helper { */ public static int sVisibleDatasetsMaxCount = 3; /** * When non-null, overrides whether the UI should be shown on full-screen mode. */ public static Boolean sFullScreenMode = null; private Helper() { throw new UnsupportedOperationException("contains static members only"); } Loading services/autofill/java/com/android/server/autofill/ui/FillUi.java +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.autofill.ui; import static com.android.server.autofill.Helper.paramsToString; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sFullScreenMode; import static com.android.server.autofill.Helper.sVerbose; import android.annotation.AttrRes; Loading Loading @@ -133,6 +134,10 @@ final class FillUi { private boolean mDestroyed; public static boolean isFullScreen(Context context) { if (sFullScreenMode != null) { if (sVerbose) Slog.v(TAG, "forcing full-screen mode to " + sFullScreenMode); return sFullScreenMode; } return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); } Loading Loading
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +21 −5 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.content.Context.AUTOFILL_MANAGER_SERVICE; import static com.android.server.autofill.Helper.bundleToString; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sFullScreenMode; import static com.android.server.autofill.Helper.sPartitionMaxCount; import static com.android.server.autofill.Helper.sVisibleDatasetsMaxCount; import static com.android.server.autofill.Helper.sVerbose; Loading Loading @@ -449,7 +450,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public int getMaxPartitions() { int getMaxPartitions() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); synchronized (mLock) { Loading @@ -458,7 +459,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void setMaxPartitions(int max) { void setMaxPartitions(int max) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Slog.i(TAG, "setMaxPartitions(): " + max); synchronized (mLock) { Loading @@ -467,7 +468,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public int getMaxVisibleDatasets() { int getMaxVisibleDatasets() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); synchronized (mLock) { Loading @@ -476,7 +477,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void setMaxVisibleDatasets(int max) { void setMaxVisibleDatasets(int max) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Slog.i(TAG, "setMaxVisibleDatasets(): " + max); synchronized (mLock) { Loading @@ -485,7 +486,7 @@ public final class AutofillManagerService extends SystemService { } // Called by Shell command. public void getScore(@Nullable String algorithmName, @NonNull String value1, void getScore(@Nullable String algorithmName, @NonNull String value1, @NonNull String value2, @NonNull RemoteCallback callback) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); Loading @@ -496,6 +497,18 @@ public final class AutofillManagerService extends SystemService { Arrays.asList(AutofillValue.forText(value1)), new String[] { value2 }); } // Called by Shell command. Boolean getFullScreenMode() { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); return sFullScreenMode; } // Called by Shell command. void setFullScreenMode(@Nullable Boolean mode) { mContext.enforceCallingPermission(MANAGE_AUTO_FILL, TAG); sFullScreenMode = mode; } private void setDebugLocked(boolean debug) { com.android.server.autofill.Helper.sDebug = debug; android.view.autofill.Helper.sDebug = debug; Loading Loading @@ -1159,6 +1172,9 @@ public final class AutofillManagerService extends SystemService { pw.print("Disabled users: "); pw.println(mDisabledUsers); pw.print("Max partitions per session: "); pw.println(sPartitionMaxCount); pw.print("Max visible datasets: "); pw.println(sVisibleDatasetsMaxCount); if (sFullScreenMode != null) { pw.print("Overridden full-screen mode: "); pw.println(sFullScreenMode); } pw.println("User data constraints: "); UserData.dumpConstraints(prefix, pw); final int size = mServicesCache.size(); pw.print("Cached services: "); Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceShellCommand.java +43 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,12 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" get max_visible_datasets"); pw.println(" Gets the maximum number of visible datasets in the UI."); pw.println(""); pw.println(" get full_screen_mode"); pw.println(" Gets the Fill UI full screen mode"); pw.println(""); pw.println(" get fc_score [--algorithm ALGORITHM] value1 value2"); pw.println(" Gets the field classification score for 2 fields."); pw.println(""); pw.println(" set log_level [off | debug | verbose]"); pw.println(" Sets the Autofill log level."); pw.println(""); Loading @@ -89,6 +95,9 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" set max_visible_datasets number"); pw.println(" Sets the maximum number of visible datasets in the UI."); pw.println(""); pw.println(" set full_screen_mode [true | false | default]"); pw.println(" Sets the Fill UI full screen mode"); pw.println(""); pw.println(" list sessions [--user USER_ID]"); pw.println(" Lists all pending sessions."); pw.println(""); Loading @@ -98,9 +107,6 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { pw.println(" reset"); pw.println(" Resets all pending sessions and cached service connections."); pw.println(""); pw.println(" get fc_score [--algorithm ALGORITHM] value1 value2"); pw.println(" Gets the field classification score for 2 fields."); pw.println(""); } } Loading @@ -115,6 +121,8 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return getMaxVisibileDatasets(pw); case "fc_score": return getFieldClassificationScore(pw); case "full_screen_mode": return getFullScreenMode(pw); default: pw.println("Invalid set: " + what); return -1; Loading @@ -131,6 +139,8 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return setMaxPartitions(); case "max_visible_datasets": return setMaxVisibileDatasets(); case "full_screen_mode": return setFullScreenMode(pw); default: pw.println("Invalid set: " + what); return -1; Loading Loading @@ -219,6 +229,36 @@ public final class AutofillManagerServiceShellCommand extends ShellCommand { return waitForLatch(pw, latch); } private int getFullScreenMode(PrintWriter pw) { final Boolean mode = mService.getFullScreenMode(); if (mode == null) { pw.println("default"); } else if (mode) { pw.println("true"); } else { pw.println("false"); } return 0; } private int setFullScreenMode(PrintWriter pw) { final String mode = getNextArgRequired(); switch (mode.toLowerCase()) { case "true": mService.setFullScreenMode(Boolean.TRUE); return 0; case "false": mService.setFullScreenMode(Boolean.FALSE); return 0; case "default": mService.setFullScreenMode(null); return 0; default: pw.println("Invalid mode: " + mode); return -1; } } private int requestDestroy(PrintWriter pw) { if (!isNextArgSessions(pw)) { return -1; Loading
services/autofill/java/com/android/server/autofill/Helper.java +5 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,11 @@ public final class Helper { */ public static int sVisibleDatasetsMaxCount = 3; /** * When non-null, overrides whether the UI should be shown on full-screen mode. */ public static Boolean sFullScreenMode = null; private Helper() { throw new UnsupportedOperationException("contains static members only"); } Loading
services/autofill/java/com/android/server/autofill/ui/FillUi.java +5 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.autofill.ui; import static com.android.server.autofill.Helper.paramsToString; import static com.android.server.autofill.Helper.sDebug; import static com.android.server.autofill.Helper.sFullScreenMode; import static com.android.server.autofill.Helper.sVerbose; import android.annotation.AttrRes; Loading Loading @@ -133,6 +134,10 @@ final class FillUi { private boolean mDestroyed; public static boolean isFullScreen(Context context) { if (sFullScreenMode != null) { if (sVerbose) Slog.v(TAG, "forcing full-screen mode to " + sFullScreenMode); return sFullScreenMode; } return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK); } Loading