Merge "Update backlinks UI to match mocks." into main
diff --git a/packages/SystemUI/res-keyguard/values/dimens.xml b/packages/SystemUI/res-keyguard/values/dimens.xml
index 186bd7c..ba0d7de 100644
--- a/packages/SystemUI/res-keyguard/values/dimens.xml
+++ b/packages/SystemUI/res-keyguard/values/dimens.xml
@@ -175,4 +175,6 @@
<dimen name="sfps_progress_bar_padding_from_edge">7dp</dimen>
<dimen name="keyguard_presentation_width">410dp</dimen>
+
+ <dimen name="appclips_backlinks_icon_size">24dp</dimen>
</resources>
diff --git a/packages/SystemUI/res/drawable/backlinks_rounded_rectangle.xml b/packages/SystemUI/res/drawable/backlinks_rounded_rectangle.xml
new file mode 100644
index 0000000..225f7bd
--- /dev/null
+++ b/packages/SystemUI/res/drawable/backlinks_rounded_rectangle.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<inset xmlns:android="http://schemas.android.com/apk/res/android"
+ android:insetBottom="4dp"
+ android:insetTop="4dp">
+ <shape android:shape="rectangle">
+ <corners android:radius="8dp" />
+ <solid android:color="@android:color/system_surface_container_highest_light" />
+ </shape>
+</inset>
\ No newline at end of file
diff --git a/packages/SystemUI/res/layout/app_clips_screenshot.xml b/packages/SystemUI/res/layout/app_clips_screenshot.xml
index a3af9490..6d4e410 100644
--- a/packages/SystemUI/res/layout/app_clips_screenshot.xml
+++ b/packages/SystemUI/res/layout/app_clips_screenshot.xml
@@ -51,13 +51,30 @@
app:layout_constraintStart_toEndOf="@id/save"
app:layout_constraintTop_toTopOf="parent" />
+ <CheckBox
+ android:id="@+id/backlinks_include_data"
+ android:layout_width="wrap_content"
+ android:layout_height="48dp"
+ android:layout_marginStart="16dp"
+ android:checked="true"
+ android:text="@string/backlinks_include_link"
+ android:visibility="gone"
+ app:layout_constraintBottom_toTopOf="@id/preview"
+ app:layout_constraintStart_toEndOf="@id/cancel"
+ app:layout_constraintTop_toTopOf="parent" />
+
<TextView
android:id="@+id/backlinks_data"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginStart="8dp"
+ android:layout_height="48dp"
+ android:layout_marginStart="16dp"
+ android:background="@drawable/backlinks_rounded_rectangle"
+ android:drawablePadding="4dp"
+ android:gravity="center"
+ android:paddingHorizontal="8dp"
android:visibility="gone"
- app:layout_constraintStart_toEndOf="@id/cancel"
+ app:layout_constraintBottom_toTopOf="@id/preview"
+ app:layout_constraintStart_toEndOf="@id/backlinks_include_data"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 3eacaa1..2f61b12 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -269,8 +269,7 @@
<string name="screenshot_detected_multiple_template"><xliff:g id="appName" example="Google Chrome">%1$s</xliff:g> and other open apps detected this screenshot.</string>
<!-- Add to note button used in App Clips flow to return the saved screenshot image to notes app. [CHAR LIMIT=NONE] -->
<string name="app_clips_save_add_to_note">Add to note</string>
- <!-- TODO(b/300307759): Temporary string for text view that displays backlinks data. [CHAR LIMIT=NONE] -->
- <string name="backlinks_string" translatable="false">Open <xliff:g id="appName" example="Google Chrome">%1$s</xliff:g></string>
+ <string name="backlinks_include_link">Include link</string>
<!-- Notification title displayed for screen recording [CHAR LIMIT=50]-->
<string name="screenrecord_title">Screen Recorder</string>
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsActivity.java b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsActivity.java
index 59b47dc..24095431 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsActivity.java
@@ -29,7 +29,6 @@
import android.app.Activity;
import android.content.BroadcastReceiver;
-import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -46,6 +45,7 @@
import android.util.Log;
import android.view.View;
import android.widget.Button;
+import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
@@ -100,7 +100,8 @@
private CropView mCropView;
private Button mSave;
private Button mCancel;
- private TextView mBacklinksData;
+ private CheckBox mBacklinksIncludeDataCheckBox;
+ private TextView mBacklinksDataTextView;
private AppClipsViewModel mViewModel;
private ResultReceiver mResultReceiver;
@@ -161,13 +162,17 @@
mSave.setOnClickListener(this::onClick);
mCancel.setOnClickListener(this::onClick);
mCropView = mLayout.findViewById(R.id.crop_view);
- mBacklinksData = mLayout.findViewById(R.id.backlinks_data);
mPreview = mLayout.findViewById(R.id.preview);
-
mPreview.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) ->
updateImageDimensions());
+ mBacklinksDataTextView = mLayout.findViewById(R.id.backlinks_data);
+ mBacklinksIncludeDataCheckBox = mLayout.findViewById(R.id.backlinks_include_data);
+ mBacklinksIncludeDataCheckBox.setOnCheckedChangeListener(
+ (buttonView, isChecked) ->
+ mBacklinksDataTextView.setVisibility(isChecked ? View.VISIBLE : View.GONE));
+
mViewModel = new ViewModelProvider(this, mViewModelFactory).get(AppClipsViewModel.class);
mViewModel.getScreenshot().observe(this, this::setScreenshot);
mViewModel.getResultLiveData().observe(this, this::setResultThenFinish);
@@ -297,13 +302,18 @@
finish();
}
- private void setBacklinksData(ClipData clipData) {
- if (mBacklinksData.getVisibility() == View.GONE) {
- mBacklinksData.setVisibility(View.VISIBLE);
- }
+ private void setBacklinksData(InternalBacklinksData backlinksData) {
+ mBacklinksIncludeDataCheckBox.setVisibility(View.VISIBLE);
+ mBacklinksDataTextView.setVisibility(
+ mBacklinksIncludeDataCheckBox.isChecked() ? View.VISIBLE : View.GONE);
- mBacklinksData.setText(String.format(getString(R.string.backlinks_string),
- clipData.getDescription().getLabel()));
+ mBacklinksDataTextView.setText(backlinksData.getClipData().getDescription().getLabel());
+
+ Drawable appIcon = backlinksData.getAppIcon();
+ int size = getResources().getDimensionPixelSize(R.dimen.appclips_backlinks_icon_size);
+ appIcon.setBounds(/* left= */ 0, /* top= */ 0, /* right= */ size, /* bottom= */ size);
+ mBacklinksDataTextView.setCompoundDrawablesRelative(/* start= */ appIcon, /* top= */
+ null, /* end= */ null, /* bottom= */ null);
}
private void setError(int errorCode) {
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java
index 9bb7bbf..d30d518 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/AppClipsViewModel.java
@@ -92,7 +92,7 @@
private final MutableLiveData<Bitmap> mScreenshotLiveData;
private final MutableLiveData<Uri> mResultLiveData;
private final MutableLiveData<Integer> mErrorLiveData;
- private final MutableLiveData<ClipData> mBacklinksLiveData;
+ private final MutableLiveData<InternalBacklinksData> mBacklinksLiveData;
private AppClipsViewModel(AppClipsCrossProcessHelper appClipsCrossProcessHelper,
ImageExporter imageExporter, IActivityTaskManager atmService,
@@ -144,10 +144,11 @@
*/
void triggerBacklinks(Set<Integer> taskIdsToIgnore, int displayId) {
mBgExecutor.execute(() -> {
- ListenableFuture<ClipData> backlinksData = getBacklinksData(taskIdsToIgnore, displayId);
+ ListenableFuture<InternalBacklinksData> backlinksData = getBacklinksData(
+ taskIdsToIgnore, displayId);
Futures.addCallback(backlinksData, new FutureCallback<>() {
@Override
- public void onSuccess(@Nullable ClipData result) {
+ public void onSuccess(@Nullable InternalBacklinksData result) {
if (result != null) {
mBacklinksLiveData.setValue(result);
}
@@ -180,8 +181,8 @@
return mErrorLiveData;
}
- /** Returns a {@link LiveData} that holds the Backlinks data in {@link ClipData}. */
- LiveData<ClipData> getBacklinksLiveData() {
+ /** Returns a {@link LiveData} that holds Backlinks data in {@link InternalBacklinksData}. */
+ LiveData<InternalBacklinksData> getBacklinksLiveData() {
return mBacklinksLiveData;
}
@@ -226,7 +227,7 @@
return HardwareRenderer.createHardwareBitmap(output, bounds.width(), bounds.height());
}
- private ListenableFuture<ClipData> getBacklinksData(Set<Integer> taskIdsToIgnore,
+ private ListenableFuture<InternalBacklinksData> getBacklinksData(Set<Integer> taskIdsToIgnore,
int displayId) {
return getAllRootTaskInfosOnDisplay(displayId)
.stream()
@@ -264,8 +265,9 @@
!= null;
}
- private ListenableFuture<ClipData> getBacklinksDataForTaskId(RootTaskInfo taskInfo) {
- SettableFuture<ClipData> backlinksData = SettableFuture.create();
+ private ListenableFuture<InternalBacklinksData> getBacklinksDataForTaskId(
+ RootTaskInfo taskInfo) {
+ SettableFuture<InternalBacklinksData> backlinksData = SettableFuture.create();
int taskId = taskInfo.taskId;
mAssistContentRequester.requestAssistContent(taskId, assistContent ->
backlinksData.set(getBacklinksDataFromAssistContent(taskInfo, assistContent)));
@@ -273,7 +275,7 @@
}
/**
- * A utility method to get {@link ClipData} to use for Backlinks functionality from
+ * A utility method to get {@link InternalBacklinksData} to use for Backlinks functionality from
* {@link AssistContent} received from the app whose screenshot is taken.
*
* <p>There are multiple ways an app can provide deep-linkable data via {@link AssistContent}
@@ -289,14 +291,16 @@
*
* @param taskInfo {@link RootTaskInfo} of the task which provided the {@link AssistContent}.
* @param content the {@link AssistContent} to map into Backlinks {@link ClipData}.
- * @return {@link ClipData} that represents the Backlinks data.
+ * @return {@link InternalBacklinksData} that represents the Backlinks data along with app icon.
*/
- private ClipData getBacklinksDataFromAssistContent(RootTaskInfo taskInfo,
+ private InternalBacklinksData getBacklinksDataFromAssistContent(RootTaskInfo taskInfo,
@Nullable AssistContent content) {
String appName = getAppNameOfTask(taskInfo);
String packageName = taskInfo.topActivity.getPackageName();
- ClipData fallback = ClipData.newIntent(appName,
+ Drawable appIcon = taskInfo.topActivityInfo.loadIcon(mPackageManager);
+ ClipData mainLauncherIntent = ClipData.newIntent(appName,
getMainLauncherIntentForPackage(packageName));
+ InternalBacklinksData fallback = new InternalBacklinksData(mainLauncherIntent, appIcon);
if (content == null) {
return fallback;
}
@@ -306,7 +310,7 @@
Uri uri = content.getWebUri();
Intent backlinksIntent = new Intent(ACTION_VIEW).setData(uri);
if (doesIntentResolveToSamePackage(backlinksIntent, packageName)) {
- return ClipData.newRawUri(appName, uri);
+ return new InternalBacklinksData(ClipData.newRawUri(appName, uri), appIcon);
}
}
@@ -314,7 +318,8 @@
if (content.isAppProvidedIntent()) {
Intent backlinksIntent = content.getIntent();
if (doesIntentResolveToSamePackage(backlinksIntent, packageName)) {
- return ClipData.newIntent(appName, backlinksIntent);
+ return new InternalBacklinksData(ClipData.newIntent(appName, backlinksIntent),
+ appIcon);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt
new file mode 100644
index 0000000..0e312f9
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/appclips/InternalBacklinksData.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.screenshot.appclips
+
+import android.content.ClipData
+import android.graphics.drawable.Drawable
+
+/** A class to hold the [ClipData] for backlinks and the corresponding app's [Drawable] icon. */
+internal data class InternalBacklinksData(val clipData: ClipData, val appIcon: Drawable)
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
index 2981590..9986205 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsActivityTest.java
@@ -43,6 +43,8 @@
import android.content.pm.PackageManager.ApplicationInfoFlags;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.ShapeDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
@@ -54,6 +56,7 @@
import android.testing.AndroidTestingRunner;
import android.view.Display;
import android.view.View;
+import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;
@@ -99,11 +102,14 @@
private static final int BACKLINKS_TASK_ID = 42;
private static final String BACKLINKS_TASK_APP_NAME = "Backlinks app";
private static final String BACKLINKS_TASK_PACKAGE_NAME = "backlinksTaskPackageName";
+
private static final RootTaskInfo TASK_THAT_SUPPORTS_BACKLINKS =
createTaskInfoForBacklinksTask();
-
private static final AssistContent ASSIST_CONTENT_FOR_BACKLINKS_TASK =
createAssistContentForBacklinksTask();
+ private static final Drawable FAKE_DRAWABLE = new ShapeDrawable();
+
+ private ArgumentCaptor<Integer> mDisplayIdCaptor = ArgumentCaptor.forClass(Integer.class);
@Mock
private AppClipsCrossProcessHelper mAppClipsCrossProcessHelper;
@@ -171,6 +177,8 @@
assertThat(((ImageView) mActivity.findViewById(R.id.preview)).getDrawable()).isNotNull();
assertThat(mActivity.findViewById(R.id.backlinks_data).getVisibility())
.isEqualTo(View.GONE);
+ assertThat(mActivity.findViewById(R.id.backlinks_include_data).getVisibility())
+ .isEqualTo(View.GONE);
}
@Test
@@ -214,9 +222,44 @@
@Test
@EnableFlags(Flags.FLAG_APP_CLIPS_BACKLINKS)
public void appClipsLaunched_backlinks_displayed() throws RemoteException {
- // Set up mocking to verify backlinks view is displayed on screen.
- ArgumentCaptor<Integer> displayIdCaptor = ArgumentCaptor.forClass(Integer.class);
- when(mAtmService.getAllRootTaskInfosOnDisplay(displayIdCaptor.capture()))
+ setUpMocksForBacklinks();
+
+ launchActivity();
+ waitForIdleSync();
+
+ assertThat(mDisplayIdCaptor.getValue()).isEqualTo(mActivity.getDisplayId());
+ TextView backlinksData = mActivity.findViewById(R.id.backlinks_data);
+ assertThat(backlinksData.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(backlinksData.getText().toString()).isEqualTo(BACKLINKS_TASK_APP_NAME);
+ assertThat(backlinksData.getCompoundDrawablesRelative()[0]).isEqualTo(FAKE_DRAWABLE);
+
+ CheckBox backlinksIncludeData = mActivity.findViewById(R.id.backlinks_include_data);
+ assertThat(backlinksIncludeData.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(backlinksIncludeData.getText().toString())
+ .isEqualTo(mActivity.getString(R.string.backlinks_include_link));
+ assertThat(backlinksIncludeData.isChecked()).isTrue();
+ }
+
+ @Test
+ @EnableFlags(Flags.FLAG_APP_CLIPS_BACKLINKS)
+ public void appClipsLaunched_backlinks_doNotIncludeLink() throws RemoteException {
+ setUpMocksForBacklinks();
+
+ launchActivity();
+ waitForIdleSync();
+ CheckBox backlinksIncludeData = mActivity.findViewById(R.id.backlinks_include_data);
+ runOnMainThread(() -> backlinksIncludeData.performClick());
+ waitForIdleSync();
+
+ assertThat(backlinksIncludeData.getVisibility()).isEqualTo(View.VISIBLE);
+ assertThat(backlinksIncludeData.isChecked()).isFalse();
+
+ TextView backlinksData = mActivity.findViewById(R.id.backlinks_data);
+ assertThat(backlinksData.getVisibility()).isEqualTo(View.GONE);
+ }
+
+ private void setUpMocksForBacklinks() throws RemoteException {
+ when(mAtmService.getAllRootTaskInfosOnDisplay(mDisplayIdCaptor.capture()))
.thenReturn(List.of(TASK_THAT_SUPPORTS_BACKLINKS));
doAnswer(invocation -> {
AssistContentRequester.Callback callback = invocation.getArgument(1);
@@ -226,15 +269,7 @@
when(mPackageManager
.resolveActivity(any(Intent.class), anyInt()))
.thenReturn(createBacklinksTaskResolveInfo());
-
- launchActivity();
- waitForIdleSync();
-
- assertThat(displayIdCaptor.getValue()).isEqualTo(mActivity.getDisplayId());
- TextView backlinksData = mActivity.findViewById(R.id.backlinks_data);
- assertThat(backlinksData.getVisibility()).isEqualTo(View.VISIBLE);
- assertThat(backlinksData.getText().toString()).isEqualTo(
- mActivity.getString(R.string.backlinks_string, BACKLINKS_TASK_APP_NAME));
+ when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE);
}
private void launchActivity() {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java
index dcb75d1..baf1357 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/screenshot/appclips/AppClipsViewModelTest.java
@@ -111,6 +111,7 @@
.thenReturn(List.of(createTaskInfoForBacklinksTask()));
when(mPackageManager.resolveActivity(mPackageManagerIntentCaptor.capture(), anyInt()))
.thenReturn(createBacklinksTaskResolveInfo());
+ when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE);
mViewModel = new AppClipsViewModel.Factory(mAppClipsCrossProcessHelper, mImageExporter,
mAtmService, mAssistContentRequester, mPackageManager,
@@ -202,12 +203,14 @@
assertThat(queriedIntent.getData()).isEqualTo(expectedUri);
assertThat(queriedIntent.getAction()).isEqualTo(ACTION_VIEW);
- ClipData result = mViewModel.getBacklinksLiveData().getValue();
- ClipDescription resultDescription = result.getDescription();
+ InternalBacklinksData result = mViewModel.getBacklinksLiveData().getValue();
+ assertThat(result.getAppIcon()).isEqualTo(FAKE_DRAWABLE);
+ ClipData clipData = result.getClipData();
+ ClipDescription resultDescription = clipData.getDescription();
assertThat(resultDescription.getLabel().toString()).isEqualTo(BACKLINKS_TASK_APP_NAME);
assertThat(resultDescription.getMimeType(0)).isEqualTo(MIMETYPE_TEXT_URILIST);
- assertThat(result.getItemCount()).isEqualTo(1);
- assertThat(result.getItemAt(0).getUri()).isEqualTo(expectedUri);
+ assertThat(clipData.getItemCount()).isEqualTo(1);
+ assertThat(clipData.getItemAt(0).getUri()).isEqualTo(expectedUri);
}
@Test
@@ -245,12 +248,14 @@
Intent queriedIntent = mPackageManagerIntentCaptor.getValue();
assertThat(queriedIntent.getPackage()).isEqualTo(expectedIntent.getPackage());
- ClipData result = mViewModel.getBacklinksLiveData().getValue();
- ClipDescription resultDescription = result.getDescription();
+ InternalBacklinksData result = mViewModel.getBacklinksLiveData().getValue();
+ assertThat(result.getAppIcon()).isEqualTo(FAKE_DRAWABLE);
+ ClipData clipData = result.getClipData();
+ ClipDescription resultDescription = clipData.getDescription();
assertThat(resultDescription.getLabel().toString()).isEqualTo(BACKLINKS_TASK_APP_NAME);
assertThat(resultDescription.getMimeType(0)).isEqualTo(MIMETYPE_TEXT_INTENT);
- assertThat(result.getItemCount()).isEqualTo(1);
- assertThat(result.getItemAt(0).getIntent()).isEqualTo(expectedIntent);
+ assertThat(clipData.getItemCount()).isEqualTo(1);
+ assertThat(clipData.getItemAt(0).getIntent()).isEqualTo(expectedIntent);
}
@Test
@@ -330,6 +335,7 @@
private void resetPackageManagerMockingForUsingFallbackBacklinks() {
reset(mPackageManager);
+ when(mPackageManager.loadItemIcon(any(), any())).thenReturn(FAKE_DRAWABLE);
when(mPackageManager.resolveActivity(any(Intent.class), anyInt()))
// First the logic queries whether a package has a launcher activity, this should
// resolve otherwise the logic filters out the task.
@@ -340,14 +346,17 @@
}
private void verifyMainLauncherBacklinksIntent() {
- ClipData result = mViewModel.getBacklinksLiveData().getValue();
- assertThat(result.getItemCount()).isEqualTo(1);
+ InternalBacklinksData result = mViewModel.getBacklinksLiveData().getValue();
+ assertThat(result.getAppIcon()).isEqualTo(FAKE_DRAWABLE);
- ClipDescription resultDescription = result.getDescription();
+ ClipData clipData = result.getClipData();
+ assertThat(clipData.getItemCount()).isEqualTo(1);
+
+ ClipDescription resultDescription = clipData.getDescription();
assertThat(resultDescription.getLabel().toString()).isEqualTo(BACKLINKS_TASK_APP_NAME);
assertThat(resultDescription.getMimeType(0)).isEqualTo(MIMETYPE_TEXT_INTENT);
- Intent actualBacklinksIntent = result.getItemAt(0).getIntent();
+ Intent actualBacklinksIntent = clipData.getItemAt(0).getIntent();
assertThat(actualBacklinksIntent.getPackage()).isEqualTo(BACKLINKS_TASK_PACKAGE_NAME);
assertThat(actualBacklinksIntent.getAction()).isEqualTo(ACTION_MAIN);
assertThat(actualBacklinksIntent.getCategories()).containsExactly(CATEGORY_LAUNCHER);