Merge "Merge "Improved dump() on Autofill UI." into oc-dev am: 1f74edd2d7" into oc-dev-plus-aosp
This commit is contained in:
committed by
Android (Google) Code Review
commit
0f75698035
@@ -602,6 +602,31 @@ public final class AutofillManagerService extends SystemService {
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
|
||||
|
||||
boolean showHistory = true;
|
||||
boolean uiOnly = false;
|
||||
if (args != null) {
|
||||
for (String arg : args) {
|
||||
switch(arg) {
|
||||
case "--no-history":
|
||||
showHistory = false;
|
||||
break;
|
||||
case "--ui-only":
|
||||
uiOnly = true;
|
||||
break;
|
||||
case "--help":
|
||||
pw.println("Usage: dumpsys autofill [--ui-only|--no-history]");
|
||||
return;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid dump arg: " + arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (uiOnly) {
|
||||
mUi.dump(pw);
|
||||
return;
|
||||
}
|
||||
|
||||
boolean oldDebug = sDebug;
|
||||
try {
|
||||
synchronized (mLock) {
|
||||
@@ -624,8 +649,10 @@ public final class AutofillManagerService extends SystemService {
|
||||
}
|
||||
mUi.dump(pw);
|
||||
}
|
||||
pw.println("Requests history:");
|
||||
mRequestsHistory.reverseDump(fd, pw, args);
|
||||
if (showHistory) {
|
||||
pw.println("Requests history:");
|
||||
mRequestsHistory.reverseDump(fd, pw, args);
|
||||
}
|
||||
} finally {
|
||||
setDebugLocked(oldDebug);
|
||||
}
|
||||
|
||||
@@ -1043,6 +1043,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
|
||||
}
|
||||
break;
|
||||
case ACTION_VIEW_ENTERED:
|
||||
if (sVerbose && virtualBounds != null) {
|
||||
Slog.w(TAG, "entered on virtual child " + id + ": " + virtualBounds);
|
||||
}
|
||||
requestNewFillResponseIfNecessaryLocked(id, viewState, flags);
|
||||
|
||||
// Remove the UI if the ViewState has changed.
|
||||
|
||||
@@ -282,13 +282,18 @@ public final class AutoFillUI {
|
||||
pw.println("Autofill UI");
|
||||
final String prefix = " ";
|
||||
final String prefix2 = " ";
|
||||
pw.print(prefix); pw.print("showsSaveUi: "); pw.println(mSaveUi != null);
|
||||
if (mFillUi != null) {
|
||||
pw.print(prefix); pw.println("showsFillUi: true");
|
||||
mFillUi.dump(pw, prefix2);
|
||||
} else {
|
||||
pw.print(prefix); pw.println("showsFillUi: false");
|
||||
}
|
||||
if (mSaveUi != null) {
|
||||
pw.print(prefix); pw.println("showsSaveUi: true");
|
||||
mSaveUi.dump(pw, prefix2);
|
||||
} else {
|
||||
pw.print(prefix); pw.println("showsSaveUi: false");
|
||||
}
|
||||
}
|
||||
|
||||
@android.annotation.UiThread
|
||||
|
||||
@@ -398,6 +398,7 @@ final class FillUi {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw, String prefix) {
|
||||
@@ -408,5 +409,21 @@ final class FillUi {
|
||||
pw.print(prefix); pw.print("mContentWidth: "); pw.println(mContentWidth);
|
||||
pw.print(prefix); pw.print("mContentHeight: "); pw.println(mContentHeight);
|
||||
pw.print(prefix); pw.print("mDestroyed: "); pw.println(mDestroyed);
|
||||
pw.print(prefix); pw.print("mWindow: ");
|
||||
if (mWindow == null) {
|
||||
pw.println("N/A");
|
||||
} else {
|
||||
final String prefix2 = prefix + " ";
|
||||
pw.println();
|
||||
pw.print(prefix2); pw.print("showing: "); pw.println(mWindow.mShowing);
|
||||
pw.print(prefix2); pw.print("view: "); pw.println(mWindow.mContentView);
|
||||
pw.print(prefix2); pw.print("screen coordinates: ");
|
||||
if (mWindow.mContentView == null) {
|
||||
pw.println("N/A");
|
||||
} else {
|
||||
final int[] coordinates = mWindow.mContentView.getLocationOnScreen();
|
||||
pw.print(coordinates[0]); pw.print("x"); pw.println(coordinates[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ import android.view.View;
|
||||
import com.android.internal.R;
|
||||
import com.android.server.UiThread;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Autofill Save Prompt
|
||||
*/
|
||||
@@ -96,6 +98,9 @@ final class SaveUi {
|
||||
|
||||
private final @NonNull OneTimeListener mListener;
|
||||
|
||||
private final CharSequence mTitle;
|
||||
private final CharSequence mSubTitle;
|
||||
|
||||
private boolean mDestroyed;
|
||||
|
||||
SaveUi(@NonNull Context context, @NonNull CharSequence providerLabel, @NonNull SaveInfo info,
|
||||
@@ -126,37 +131,36 @@ final class SaveUi {
|
||||
types.add(context.getString(R.string.autofill_save_type_email_address));
|
||||
}
|
||||
|
||||
final CharSequence title;
|
||||
switch (types.size()) {
|
||||
case 1:
|
||||
title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_type,
|
||||
mTitle = Html.fromHtml(context.getString(R.string.autofill_save_title_with_type,
|
||||
types.valueAt(0), providerLabel), 0);
|
||||
break;
|
||||
case 2:
|
||||
title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_2types,
|
||||
mTitle = Html.fromHtml(context.getString(R.string.autofill_save_title_with_2types,
|
||||
types.valueAt(0), types.valueAt(1), providerLabel), 0);
|
||||
break;
|
||||
case 3:
|
||||
title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_3types,
|
||||
mTitle = Html.fromHtml(context.getString(R.string.autofill_save_title_with_3types,
|
||||
types.valueAt(0), types.valueAt(1), types.valueAt(2), providerLabel), 0);
|
||||
break;
|
||||
default:
|
||||
// Use generic if more than 3 or invalid type (size 0).
|
||||
title = Html.fromHtml(
|
||||
mTitle = Html.fromHtml(
|
||||
context.getString(R.string.autofill_save_title, providerLabel), 0);
|
||||
}
|
||||
|
||||
titleView.setText(title);
|
||||
final CharSequence subTitle = info.getDescription();
|
||||
if (subTitle != null) {
|
||||
titleView.setText(mTitle);
|
||||
mSubTitle = info.getDescription();
|
||||
if (mSubTitle != null) {
|
||||
final TextView subTitleView = (TextView) view.findViewById(R.id.autofill_save_subtitle);
|
||||
subTitleView.setText(subTitle);
|
||||
subTitleView.setText(mSubTitle);
|
||||
subTitleView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
Slog.i(TAG, "Showing save dialog: " + title);
|
||||
Slog.i(TAG, "Showing save dialog: " + mTitle);
|
||||
if (sDebug) {
|
||||
Slog.d(TAG, "SubTitle: " + subTitle);
|
||||
Slog.d(TAG, "SubTitle: " + mSubTitle);
|
||||
}
|
||||
|
||||
final TextView noButton = view.findViewById(R.id.autofill_save_no);
|
||||
@@ -207,4 +211,18 @@ final class SaveUi {
|
||||
throw new IllegalStateException("cannot interact with a destroyed instance");
|
||||
}
|
||||
}
|
||||
|
||||
void dump(PrintWriter pw, String prefix) {
|
||||
pw.print(prefix); pw.print("title: "); pw.println(mTitle);
|
||||
pw.print(prefix); pw.print("subtitle: "); pw.println(mSubTitle);
|
||||
|
||||
final View view = mDialog.getWindow().getDecorView();
|
||||
final int[] loc = view.getLocationOnScreen();
|
||||
pw.print(prefix); pw.print("coordinates: ");
|
||||
pw.print('('); pw.print(loc[0]); pw.print(','); pw.print(loc[1]);pw.print(')');
|
||||
pw.print('(');
|
||||
pw.print(loc[0] + view.getWidth()); pw.print(',');
|
||||
pw.print(loc[1] + view.getHeight());pw.println(')');
|
||||
pw.print(prefix); pw.print("destroyed: "); pw.println(mDestroyed);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user