diff --git a/packages/CompanionDeviceManager/res/drawable/btn_negative_multiple_devices.xml b/packages/CompanionDeviceManager/res/drawable/btn_negative_multiple_devices.xml
index 125fee6282d5f..ece7bbafc654f 100644
--- a/packages/CompanionDeviceManager/res/drawable/btn_negative_multiple_devices.xml
+++ b/packages/CompanionDeviceManager/res/drawable/btn_negative_multiple_devices.xml
@@ -20,6 +20,6 @@
\ No newline at end of file
diff --git a/packages/CompanionDeviceManager/res/drawable/ic_device_other.xml b/packages/CompanionDeviceManager/res/drawable/ic_device_other.xml
new file mode 100644
index 0000000000000..f8515c33d57f0
--- /dev/null
+++ b/packages/CompanionDeviceManager/res/drawable/ic_device_other.xml
@@ -0,0 +1,23 @@
+
+
+
+
\ No newline at end of file
diff --git a/packages/CompanionDeviceManager/res/drawable/ic_watch.xml b/packages/CompanionDeviceManager/res/drawable/ic_watch.xml
new file mode 100644
index 0000000000000..44a40b9fede39
--- /dev/null
+++ b/packages/CompanionDeviceManager/res/drawable/ic_watch.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/CompanionDeviceManager/res/layout/activity_confirmation.xml b/packages/CompanionDeviceManager/res/layout/activity_confirmation.xml
index 9e5b1663ff45e..8eec33aeb4ee5 100644
--- a/packages/CompanionDeviceManager/res/layout/activity_confirmation.xml
+++ b/packages/CompanionDeviceManager/res/layout/activity_confirmation.xml
@@ -20,6 +20,15 @@
+
+
+ android:layout_marginBottom="12dp"
+ style="@*android:style/TextAppearance.Widget.Toolbar.Title" />
-
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
+
+
+
+
+
+
+
+
+ android:layout_marginRight="12dp"
+ android:tint="@android:color/system_accent1_600"/>
@drawable/btn_negative_multiple_devices
+
+
\ No newline at end of file
diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java
index 0ab126a7dae05..f752b697c4a5c 100644
--- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java
+++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java
@@ -29,6 +29,7 @@ import static com.android.companiondevicemanager.PermissionListAdapter.TYPE_NOTI
import static com.android.companiondevicemanager.PermissionListAdapter.TYPE_STORAGE;
import static com.android.companiondevicemanager.Utils.getApplicationLabel;
import static com.android.companiondevicemanager.Utils.getHtmlFromResources;
+import static com.android.companiondevicemanager.Utils.getIcon;
import static com.android.companiondevicemanager.Utils.getVendorHeaderIcon;
import static com.android.companiondevicemanager.Utils.getVendorHeaderName;
import static com.android.companiondevicemanager.Utils.prepareResultReceiverForIpc;
@@ -106,6 +107,9 @@ public class CompanionDeviceActivity extends FragmentActivity implements
private TextView mTitle;
private TextView mSummary;
+ // Present for single device and multiple device only.
+ private ImageView mProfileIcon;
+
// Only present for selfManaged devices.
private ImageView mVendorHeaderImage;
private TextView mVendorHeaderName;
@@ -119,10 +123,11 @@ public class CompanionDeviceActivity extends FragmentActivity implements
// regular.
private Button mButtonAllow;
private Button mButtonNotAllow;
- // Present for multiple devices association requests only.
+ // Present for multiple device association requests only.
private Button mButtonNotAllowMultipleDevices;
private LinearLayout mAssociationConfirmationDialog;
+ private LinearLayout mMultipleDeviceList;
private RelativeLayout mVendorHeader;
// The recycler view is only shown for multiple-device regular association request, after
@@ -130,6 +135,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
private @Nullable RecyclerView mDeviceListRecyclerView;
private @Nullable DeviceListAdapter mDeviceAdapter;
+
// The recycler view is only shown for selfManaged association request.
private @Nullable RecyclerView mPermissionListRecyclerView;
private @Nullable PermissionListAdapter mPermissionListAdapter;
@@ -243,12 +249,15 @@ public class CompanionDeviceActivity extends FragmentActivity implements
setContentView(R.layout.activity_confirmation);
+ mMultipleDeviceList = findViewById(R.id.multiple_device_list);
mAssociationConfirmationDialog = findViewById(R.id.activity_confirmation);
mVendorHeader = findViewById(R.id.vendor_header);
mTitle = findViewById(R.id.title);
mSummary = findViewById(R.id.summary);
+ mProfileIcon = findViewById(R.id.profile_icon);
+
mVendorHeaderImage = findViewById(R.id.vendor_header_image);
mVendorHeaderName = findViewById(R.id.vendor_header_name);
mVendorHeaderButton = findViewById(R.id.vendor_header_button);
@@ -420,6 +429,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
mVendorHeaderName.setText(vendorName);
mDeviceListRecyclerView.setVisibility(View.GONE);
+ mProfileIcon.setVisibility(View.GONE);
mVendorHeader.setVisibility(View.VISIBLE);
}
@@ -447,17 +457,22 @@ public class CompanionDeviceActivity extends FragmentActivity implements
final Spanned title = getHtmlFromResources(
this, R.string.confirmation_title, appLabel, deviceName);
final Spanned summary;
+ final Drawable profileIcon;
if (deviceProfile == null) {
summary = getHtmlFromResources(this, R.string.summary_generic);
+ profileIcon = getIcon(this, R.drawable.ic_device_other);
+ mSummary.setVisibility(View.GONE);
} else if (deviceProfile.equals(DEVICE_PROFILE_WATCH)) {
summary = getHtmlFromResources(this, R.string.summary_watch, appLabel, deviceName);
+ profileIcon = getIcon(this, R.drawable.ic_watch);
} else {
throw new RuntimeException("Unsupported profile " + deviceProfile);
}
mTitle.setText(title);
mSummary.setText(summary);
+ mProfileIcon.setImageDrawable(profileIcon);
}
private void initUiForMultipleDevices(CharSequence appLabel) {
@@ -467,12 +482,16 @@ public class CompanionDeviceActivity extends FragmentActivity implements
final String profileName;
final Spanned summary;
+ final Drawable profileIcon;
if (deviceProfile == null) {
profileName = getString(R.string.profile_name_generic);
summary = getHtmlFromResources(this, R.string.summary_generic);
+ profileIcon = getIcon(this, R.drawable.ic_device_other);
+ mSummary.setVisibility(View.GONE);
} else if (deviceProfile.equals(DEVICE_PROFILE_WATCH)) {
profileName = getString(R.string.profile_name_watch);
summary = getHtmlFromResources(this, R.string.summary_watch, appLabel);
+ profileIcon = getIcon(this, R.drawable.ic_watch);
} else {
throw new RuntimeException("Unsupported profile " + deviceProfile);
}
@@ -481,6 +500,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
mTitle.setText(title);
mSummary.setText(summary);
+ mProfileIcon.setImageDrawable(profileIcon);
mDeviceAdapter = new DeviceListAdapter(this, this::onListItemClick);
@@ -496,6 +516,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements
mButtonAllow.setVisibility(View.GONE);
mButtonNotAllow.setVisibility(View.GONE);
mButtonNotAllowMultipleDevices.setVisibility(View.VISIBLE);
+ mMultipleDeviceList.setVisibility(View.VISIBLE);
}
private void onListItemClick(int position) {
diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/Utils.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/Utils.java
index d5b2f0a748f1b..1852e82cb9f92 100644
--- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/Utils.java
+++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/Utils.java
@@ -22,7 +22,6 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.ApplicationInfoFlags;
-import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
@@ -124,7 +123,6 @@ class Utils {
static @NonNull Drawable getIcon(@NonNull Context context, int resId) {
Drawable icon = context.getResources().getDrawable(resId, null);
- icon.setTint(Color.DKGRAY);
return icon;
}