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

Commit b78f3eed authored by Qinmei Du's avatar Qinmei Du
Browse files

Add the Another device row in the more options screen

screencast: https://screencast.googleplex.com/cast/NTEwMDE0ODM2MDIxNjU3NnxmODFmOGRjMy0zMw

Test: deployed locally

Bug: 253157211
Change-Id: Ib0572d4b1b0e1f576b1cc748252782f382f8a4b1
parent 4e72b984
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -131,6 +131,13 @@ public class CreateCredentialProviderData extends ProviderData implements Parcel
            return this;
        }

        /** Sets the remote entry of the provider. */
        @NonNull
        public Builder setRemoteEntry(@Nullable Entry remoteEntry) {
            mRemoteEntry = remoteEntry;
            return this;
        }

        /** Builds a {@link CreateCredentialProviderData}. */
        @NonNull
        public CreateCredentialProviderData build() {
+15 −0
Original line number Diff line number Diff line
<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:ignore="VectorPath"
    android:name="vector"
    android:width="20dp"
    android:height="20dp"
    android:viewportWidth="20"
    android:viewportHeight="20">
    <path
        android:name="path"
        android:pathData="M 7.6 4.72 L 7.6 7.6 L 4.72 7.6 L 4.72 4.72 L 7.6 4.72 Z M 9.04 3.28 L 3.28 3.28 L 3.28 9.04 L 9.04 9.04 L 9.04 3.28 Z M 7.6 12.4 L 7.6 15.28 L 4.72 15.28 L 4.72 12.4 L 7.6 12.4 Z M 9.04 10.96 L 3.28 10.96 L 3.28 16.72 L 9.04 16.72 L 9.04 10.96 Z M 15.28 4.72 L 15.28 7.6 L 12.4 7.6 L 12.4 4.72 L 15.28 4.72 Z M 16.72 3.28 L 10.96 3.28 L 10.96 9.04 L 16.72 9.04 L 16.72 3.28 Z M 10.96 10.96 L 12.4 10.96 L 12.4 12.4 L 10.96 12.4 L 10.96 10.96 Z M 12.4 12.4 L 13.84 12.4 L 13.84 13.84 L 12.4 13.84 L 12.4 12.4 Z M 13.84 10.96 L 15.28 10.96 L 15.28 12.4 L 13.84 12.4 L 13.84 10.96 Z M 10.96 13.84 L 12.4 13.84 L 12.4 15.28 L 10.96 15.28 L 10.96 13.84 Z M 12.4 15.28 L 13.84 15.28 L 13.84 16.72 L 12.4 16.72 L 12.4 15.28 Z M 13.84 13.84 L 15.28 13.84 L 15.28 15.28 L 13.84 15.28 L 13.84 13.84 Z M 15.28 12.4 L 16.72 12.4 L 16.72 13.84 L 15.28 13.84 L 15.28 12.4 Z M 15.28 15.28 L 16.72 15.28 L 16.72 16.72 L 15.28 16.72 L 15.28 15.28 Z M 19.6 5.2 L 17.68 5.2 L 17.68 2.32 L 14.8 2.32 L 14.8 0.4 L 19.6 0.4 L 19.6 5.2 Z M 19.6 19.6 L 19.6 14.8 L 17.68 14.8 L 17.68 17.68 L 14.8 17.68 L 14.8 19.6 L 19.6 19.6 Z M 0.4 19.6 L 5.2 19.6 L 5.2 17.68 L 2.32 17.68 L 2.32 14.8 L 0.4 14.8 L 0.4 19.6 Z M 0.4 0.4 L 0.4 5.2 L 2.32 5.2 L 2.32 2.32 L 5.2 2.32 L 5.2 0.4 L 0.4 0.4 Z"
        android:fillColor="#000000"
        android:strokeWidth="1"/>
</vector>
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
  <string name="passkey">passkey</string>
  <string name="password">password</string>
  <string name="sign_ins">sign-ins</string>
  <string name="another_device">Another device</string>
  <string name="other_password_manager">Other password manager</string>
  <!-- Spoken content description of an element which will close the sheet when clicked. -->
  <string name="close_sheet">"Close sheet"</string>
+16 −0
Original line number Diff line number Diff line
@@ -181,6 +181,9 @@ class CredentialManagerRepo(
              20, 7, 27, 11000),
          )
        )
        .setRemoteEntry(
          newRemoteEntry("key1", "subkey-1")
        )
        .setIsDefaultProvider(true)
        .build(),
      CreateCredentialProviderData
@@ -308,6 +311,19 @@ class CredentialManagerRepo(
    )
  }

  private fun newRemoteEntry(
    key: String,
    subkey: String,
  ): Entry {
    return Entry(
      key,
      subkey,
      Slice.Builder(
        Entry.CREDENTIAL_MANAGER_ENTRY_URI, SliceSpec(Entry.VERSION, 1)
      ).build()
    )
  }

  private fun testCreateRequestInfo(): RequestInfo {
    val data = Bundle()
    return RequestInfo.newCreateRequestInfo(
+14 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.credentials.ui.GetCredentialProviderData
import android.credentials.ui.CreateCredentialProviderData
import android.credentials.ui.DisabledProviderData
import com.android.credentialmanager.createflow.CreateOptionInfo
import com.android.credentialmanager.createflow.RemoteInfo
import com.android.credentialmanager.getflow.ActionEntryInfo
import com.android.credentialmanager.getflow.AuthenticationEntryInfo
import com.android.credentialmanager.getflow.CredentialEntryInfo
@@ -120,6 +121,7 @@ class CreateFlowUtils {
          displayName = pkgInfo.applicationInfo.loadLabel(packageManager).toString(),
          createOptions = toCreationOptionInfoList(it.saveEntries, context),
          isDefault = it.isDefaultProvider,
          remoteEntry = toRemoteInfo(it.remoteEntry),
        )
      }
    }
@@ -164,5 +166,17 @@ class CreateFlowUtils {
        )
      }
    }

    private fun toRemoteInfo(
      remoteEntry: Entry?,
    ): RemoteInfo? {
      // TODO: should also call fromSlice after getting the official jetpack code.
      return if (remoteEntry != null) {
        RemoteInfo(
          entryKey = remoteEntry.key,
          entrySubkey = remoteEntry.subkey,
        )
      } else null
    }
  }
}
Loading