use of android.content.pm.LauncherApps.ShortcutQuery in project android_frameworks_base by crdroidandroid.
the class BaseShortcutManagerTest method getLauncherShortcuts.
protected List<ShortcutInfo> getLauncherShortcuts(String launcher, int userId, int queryFlags) {
final List<ShortcutInfo>[] ret = new List[1];
runWithCaller(launcher, userId, () -> {
final ShortcutQuery q = new ShortcutQuery();
q.setQueryFlags(queryFlags);
ret[0] = mLauncherApps.getShortcuts(q, UserHandle.of(userId));
});
return ret[0];
}
use of android.content.pm.LauncherApps.ShortcutQuery in project platform_frameworks_base by android.
the class ShortcutManagerTest1 method testGetShortcuts_resolveStrings.
public void testGetShortcuts_resolveStrings() throws Exception {
runWithCaller(CALLING_PACKAGE_1, USER_0, () -> {
ShortcutInfo si = new ShortcutInfo.Builder(mClientContext).setId("id").setActivity(new ComponentName(mClientContext, "dummy")).setTitleResId(10).setTextResId(11).setDisabledMessageResId(12).setIntent(makeIntent("action", ShortcutActivity.class)).build();
mManager.setDynamicShortcuts(list(si));
});
runWithCaller(CALLING_PACKAGE_1, USER_P0, () -> {
ShortcutInfo si = new ShortcutInfo.Builder(mClientContext).setId("id").setActivity(new ComponentName(mClientContext, "dummy")).setTitleResId(10).setTextResId(11).setDisabledMessageResId(12).setIntent(makeIntent("action", ShortcutActivity.class)).build();
mManager.setDynamicShortcuts(list(si));
});
runWithCaller(LAUNCHER_1, USER_0, () -> {
final ShortcutQuery q = new ShortcutQuery();
q.setQueryFlags(ShortcutQuery.FLAG_GET_DYNAMIC);
// USER 0
List<ShortcutInfo> ret = assertShortcutIds(assertAllStringsResolved(mLauncherApps.getShortcuts(q, HANDLE_USER_0)), "id");
assertEquals("string-com.android.test.1-user:0-res:10/en", ret.get(0).getTitle());
assertEquals("string-com.android.test.1-user:0-res:11/en", ret.get(0).getText());
assertEquals("string-com.android.test.1-user:0-res:12/en", ret.get(0).getDisabledMessage());
// USER P0
ret = assertShortcutIds(assertAllStringsResolved(mLauncherApps.getShortcuts(q, HANDLE_USER_P0)), "id");
assertEquals("string-com.android.test.1-user:20-res:10/en", ret.get(0).getTitle());
assertEquals("string-com.android.test.1-user:20-res:11/en", ret.get(0).getText());
assertEquals("string-com.android.test.1-user:20-res:12/en", ret.get(0).getDisabledMessage());
});
}
use of android.content.pm.LauncherApps.ShortcutQuery in project platform_frameworks_base by android.
the class BaseShortcutManagerTest method buildAllQuery.
protected static ShortcutQuery buildAllQuery(String packageName) {
final ShortcutQuery q = new ShortcutQuery();
q.setPackage(packageName);
q.setQueryFlags(ShortcutQuery.FLAG_GET_ALL_KINDS);
return q;
}
use of android.content.pm.LauncherApps.ShortcutQuery in project platform_frameworks_base by android.
the class BaseShortcutManagerTest method buildQueryWithFlags.
protected static ShortcutQuery buildQueryWithFlags(int queryFlags) {
final ShortcutQuery q = new ShortcutQuery();
q.setQueryFlags(queryFlags);
return q;
}
use of android.content.pm.LauncherApps.ShortcutQuery in project platform_frameworks_base by android.
the class BaseShortcutManagerTest method buildQuery.
protected static ShortcutQuery buildQuery(long changedSince, String packageName, List<String> shortcutIds, ComponentName componentName, /* @ShortcutQuery.QueryFlags */
int flags) {
final ShortcutQuery q = new ShortcutQuery();
q.setChangedSince(changedSince);
q.setPackage(packageName);
q.setShortcutIds(shortcutIds);
q.setActivity(componentName);
q.setQueryFlags(flags);
return q;
}
Aggregations