Merge "DeviceConfig for Chooser update-delay duration." into tm-dev am: 31cc9ddb59
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17862572 Change-Id: Idb4e640f14a7c4bc233981bb8e2912b6138ee294 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -194,9 +194,6 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
private static final String PLURALS_COUNT = "count";
|
private static final String PLURALS_COUNT = "count";
|
||||||
private static final String PLURALS_FILE_NAME = "file_name";
|
private static final String PLURALS_FILE_NAME = "file_name";
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
public static final int LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS = 250;
|
|
||||||
|
|
||||||
private boolean mIsAppPredictorComponentAvailable;
|
private boolean mIsAppPredictorComponentAvailable;
|
||||||
private Map<ChooserTarget, AppTarget> mDirectShareAppTargetCache;
|
private Map<ChooserTarget, AppTarget> mDirectShareAppTargetCache;
|
||||||
private Map<ChooserTarget, ShortcutInfo> mDirectShareShortcutInfoCache;
|
private Map<ChooserTarget, ShortcutInfo> mDirectShareShortcutInfoCache;
|
||||||
@@ -248,6 +245,13 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
SystemUiDeviceConfigFlags.IS_NEARBY_SHARE_FIRST_TARGET_IN_RANKED_APP,
|
SystemUiDeviceConfigFlags.IS_NEARBY_SHARE_FIRST_TARGET_IN_RANKED_APP,
|
||||||
DEFAULT_IS_NEARBY_SHARE_FIRST_TARGET_IN_RANKED_APP);
|
DEFAULT_IS_NEARBY_SHARE_FIRST_TARGET_IN_RANKED_APP);
|
||||||
|
|
||||||
|
private static final int DEFAULT_LIST_VIEW_UPDATE_DELAY_MS = 250;
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
int mListViewUpdateDelayMs = DeviceConfig.getInt(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||||
|
SystemUiDeviceConfigFlags.SHARESHEET_LIST_VIEW_UPDATE_DELAY,
|
||||||
|
DEFAULT_LIST_VIEW_UPDATE_DELAY_MS);
|
||||||
|
|
||||||
private Bundle mReplacementExtras;
|
private Bundle mReplacementExtras;
|
||||||
private IntentSender mChosenComponentSender;
|
private IntentSender mChosenComponentSender;
|
||||||
private IntentSender mRefinementIntentSender;
|
private IntentSender mRefinementIntentSender;
|
||||||
@@ -2624,7 +2628,7 @@ public class ChooserActivity extends ResolverActivity implements
|
|||||||
Message msg = Message.obtain();
|
Message msg = Message.obtain();
|
||||||
msg.what = ChooserHandler.LIST_VIEW_UPDATE_MESSAGE;
|
msg.what = ChooserHandler.LIST_VIEW_UPDATE_MESSAGE;
|
||||||
msg.obj = userHandle;
|
msg.obj = userHandle;
|
||||||
mChooserHandler.sendMessageDelayed(msg, LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
mChooserHandler.sendMessageDelayed(msg, mListViewUpdateDelayMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -519,6 +519,13 @@ public final class SystemUiDeviceConfigFlags {
|
|||||||
*/
|
*/
|
||||||
public static final String USE_UNBUNDLED_SHARESHEET = "use_unbundled_sharesheet";
|
public static final String USE_UNBUNDLED_SHARESHEET = "use_unbundled_sharesheet";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (int) The delay (in ms) before refreshing the Sharesheet UI after a change to the share
|
||||||
|
* target data model. For more info see go/sharesheet-list-view-update-delay.
|
||||||
|
*/
|
||||||
|
public static final String SHARESHEET_LIST_VIEW_UPDATE_DELAY =
|
||||||
|
"sharesheet_list_view_update_delay";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (string) Name of the default QR code scanner activity. On the eligible devices this activity
|
* (string) Name of the default QR code scanner activity. On the eligible devices this activity
|
||||||
* is provided by GMS core.
|
* is provided by GMS core.
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ public class ChooserActivityTest {
|
|||||||
List<ResolvedComponentInfo> stableCopy =
|
List<ResolvedComponentInfo> stableCopy =
|
||||||
createResolvedComponentsForTestWithOtherProfile(2, /* userId= */ 10);
|
createResolvedComponentsForTestWithOtherProfile(2, /* userId= */ 10);
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
onView(first(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name)))
|
onView(first(withText(stableCopy.get(1).getResolveInfoAt(0).activityInfo.name)))
|
||||||
.perform(click());
|
.perform(click());
|
||||||
@@ -1437,7 +1437,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
||||||
activity.getAdapter().getCount(), is(3));
|
activity.getAdapter().getCount(), is(3));
|
||||||
@@ -1513,7 +1513,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
||||||
activity.getAdapter().getCount(), is(3));
|
activity.getAdapter().getCount(), is(3));
|
||||||
@@ -1595,7 +1595,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
||||||
wrapper.getAdapter().getCount(), is(3));
|
wrapper.getAdapter().getCount(), is(3));
|
||||||
@@ -1667,7 +1667,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat("Chooser should have 4 targets (2 apps, 2 direct)",
|
assertThat("Chooser should have 4 targets (2 apps, 2 direct)",
|
||||||
wrapper.getAdapter().getCount(), is(4));
|
wrapper.getAdapter().getCount(), is(4));
|
||||||
@@ -1754,7 +1754,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
String.format("Chooser should have %d targets (%d apps, 1 direct, 15 A-Z)",
|
String.format("Chooser should have %d targets (%d apps, 1 direct, 15 A-Z)",
|
||||||
@@ -1879,12 +1879,13 @@ public class ChooserActivityTest {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
final IChooserWrapper activity = (IChooserWrapper)
|
||||||
mActivityRule.launchActivity(Intent.createChooser(sendIntent, "work tab test"));
|
mActivityRule.launchActivity(Intent.createChooser(sendIntent, "work tab test"));
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
onView(withTextFromRuntimeResource("resolver_work_tab")).perform(click());
|
onView(withTextFromRuntimeResource("resolver_work_tab")).perform(click());
|
||||||
waitForIdle();
|
waitForIdle();
|
||||||
// wait for the share sheet to expand
|
// wait for the share sheet to expand
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
onView(first(allOf(
|
onView(first(allOf(
|
||||||
withText(workResolvedComponentInfos.get(0)
|
withText(workResolvedComponentInfos.get(0)
|
||||||
@@ -2143,7 +2144,7 @@ public class ChooserActivityTest {
|
|||||||
// Thread.sleep shouldn't be a thing in an integration test but it's
|
// Thread.sleep shouldn't be a thing in an integration test but it's
|
||||||
// necessary here because of the way the code is structured
|
// necessary here because of the way the code is structured
|
||||||
// TODO: restructure the tests b/129870719
|
// TODO: restructure the tests b/129870719
|
||||||
Thread.sleep(ChooserActivity.LIST_VIEW_UPDATE_INTERVAL_IN_MILLIS);
|
Thread.sleep(((ChooserActivity) activity).mListViewUpdateDelayMs);
|
||||||
|
|
||||||
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
assertThat("Chooser should have 3 targets (2 apps, 1 direct)",
|
||||||
activity.getAdapter().getCount(), is(3));
|
activity.getAdapter().getCount(), is(3));
|
||||||
|
|||||||
Reference in New Issue
Block a user