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

Commit e11139c7 authored by Felipe Leme's avatar Felipe Leme
Browse files

Show Autofill Service icon on Save UI.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

Bug: 65465974

Change-Id: Ic495be94763dda1de0edced3f9371190d09783ef
parent cd6b0e48
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -44,8 +44,14 @@
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <ImageView
                    android:id="@+id/autofill_save_icon"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:id="@+id/autofill_save_title"
                    android:paddingLeft="8dp"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@string/autofill_save_title"
+3 −0
Original line number Diff line number Diff line
@@ -604,4 +604,7 @@
    <!-- Max height of the the autofill save custom subtitle as a fraction of the screen width/height -->
    <dimen name="autofill_save_custom_subtitle_max_height">20%</dimen>

    <!-- Max (absolute) dimensions (both width and height) of autofill service icon on autofill save affordance -->
    <dimen name="autofill_save_icon_max_size">100dp</dimen>

</resources>
+3 −1
Original line number Diff line number Diff line
@@ -2900,8 +2900,9 @@
  <java-symbol type="id" name="autofill_dataset_list"/>
  <java-symbol type="id" name="autofill" />
  <java-symbol type="id" name="autofill_save_custom_subtitle" />
  <java-symbol type="id" name="autofill_save_title" />
  <java-symbol type="id" name="autofill_save_icon" />
  <java-symbol type="id" name="autofill_save_no" />
  <java-symbol type="id" name="autofill_save_title" />
  <java-symbol type="id" name="autofill_save_yes" />
  <java-symbol type="string" name="autofill_error_cannot_autofill" />
  <java-symbol type="string" name="autofill_picker_no_suggestions" />
@@ -2925,6 +2926,7 @@
  <java-symbol type="style" name="AutofillSaveAnimation" />
  <java-symbol type="dimen" name="autofill_dataset_picker_max_size"/>
  <java-symbol type="dimen" name="autofill_save_custom_subtitle_max_height"/>
  <java-symbol type="dimen" name="autofill_save_icon_max_size"/>

  <java-symbol type="dimen" name="notification_big_picture_max_height"/>
  <java-symbol type="dimen" name="notification_big_picture_max_width"/>
+7 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.Bundle;
@@ -481,10 +482,16 @@ final class AutofillManagerServiceImpl {
        sendStateToClients(true);
    }

    @NonNull
    CharSequence getServiceLabel() {
        return mInfo.getServiceInfo().loadLabel(mContext.getPackageManager());
    }

    @NonNull
    Drawable getServiceIcon() {
        return mInfo.getServiceInfo().loadIcon(mContext.getPackageManager());
    }

    /**
     * Initializes the last fill selection after an autofill service returned a new
     * {@link FillResponse}.
+4 −3
Original line number Diff line number Diff line
@@ -970,8 +970,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                mService.logSaveShown(id);
                final IAutoFillManagerClient client = getClient();
                mPendingSaveUi = new PendingUi(mActivityToken, id, client);
                getUiForShowing().showSaveUi(mService.getServiceLabel(), saveInfo,
                        valueFinder, mPackageName, this, mPendingSaveUi);
                getUiForShowing().showSaveUi(mService.getServiceLabel(), mService.getServiceIcon(),
                        saveInfo, valueFinder, mPackageName, this, mPendingSaveUi);
                if (client != null) {
                    try {
                        client.setSaveUiState(id, true);
@@ -1774,7 +1774,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState

    /**
     * Checks whether this session is hiding the Save UI to handle a custom description link for
     * a specific {@code token} created by {@link PendingUi#PendingUi(IBinder)}.
     * a specific {@code token} created by
     * {@link PendingUi#PendingUi(IBinder, int, IAutoFillManagerClient)}.
     */
    boolean isSaveUiPendingForToken(@NonNull IBinder token) {
        return isSaveUiPending() && token.equals(mPendingSaveUi.getToken());
Loading