本文整理汇总了Java中com.android.launcher3.util.ManagedProfileHeuristic类的典型用法代码示例。如果您正苦于以下问题:Java ManagedProfileHeuristic类的具体用法?Java ManagedProfileHeuristic怎么用?Java ManagedProfileHeuristic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ManagedProfileHeuristic类属于com.android.launcher3.util包,在下文中一共展示了ManagedProfileHeuristic类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onEmptyDbCreated
import com.android.launcher3.util.ManagedProfileHeuristic; //导入依赖的package包/类
/**
* Overriden in tests.
*/
protected void onEmptyDbCreated() {
// Database was just created, so wipe any previous widgets
if (mWidgetHostResetHandler != null) {
new AppWidgetHost(mContext, Launcher.APPWIDGET_HOST_ID).deleteHost();
mWidgetHostResetHandler.sendMessage(Message.obtain(
mWidgetHostResetHandler,
ChangeListenerWrapper.MSG_APP_WIDGET_HOST_RESET,
mContext
));
}
// Set the flag for empty DB
Utilities.getPrefs(mContext).edit().putBoolean(EMPTY_DATABASE_CREATED, true).commit();
// When a new DB is created, remove all previously stored managed profile information.
ManagedProfileHeuristic.processAllUsers(Collections.<UserHandleCompat>emptyList(),
mContext);
}
示例2: clearHomescreen
import com.android.launcher3.util.ManagedProfileHeuristic; //导入依赖的package包/类
/**
* Removes all icons from homescreen and hotseat.
*/
public void clearHomescreen() throws Throwable {
LauncherSettings.Settings.call(mTargetContext.getContentResolver(),
LauncherSettings.Settings.METHOD_CREATE_EMPTY_DB);
LauncherSettings.Settings.call(mTargetContext.getContentResolver(),
LauncherSettings.Settings.METHOD_CLEAR_EMPTY_DB_FLAG);
LauncherClings.markFirstRunClingDismissed(mTargetContext);
ManagedProfileHeuristic.markExistingUsersForNoFolderCreation(mTargetContext);
runTestOnUiThread(new Runnable() {
@Override
public void run() {
// Reset the loader state
LauncherAppState.getInstance().getModel().resetLoadedState(true, true);
}
});
}
示例3: onCreate
import com.android.launcher3.util.ManagedProfileHeuristic; //导入依赖的package包/类
@Override
public void onCreate(SQLiteDatabase db) {
if (LOGD) Log.d(TAG, "creating new launcher database");
mMaxItemId = 1;
mMaxScreenId = 0;
mNewDbCreated = true;
UserManagerCompat userManager = UserManagerCompat.getInstance(mContext);
long userSerialNumber = userManager.getSerialNumberForUser(
UserHandleCompat.myUserHandle());
db.execSQL("CREATE TABLE favorites (" +
"_id INTEGER PRIMARY KEY," +
"title TEXT," +
"intent TEXT," +
"container INTEGER," +
"screen INTEGER," +
"cellX INTEGER," +
"cellY INTEGER," +
"spanX INTEGER," +
"spanY INTEGER," +
"itemType INTEGER," +
"appWidgetId INTEGER NOT NULL DEFAULT -1," +
"isShortcut INTEGER," +
"iconType INTEGER," +
"iconPackage TEXT," +
"iconResource TEXT," +
"icon BLOB," +
"uri TEXT," +
"displayMode INTEGER," +
"appWidgetProvider TEXT," +
"modified INTEGER NOT NULL DEFAULT 0," +
"restored INTEGER NOT NULL DEFAULT 0," +
"profileId INTEGER DEFAULT " + userSerialNumber + "," +
"hidden INTEGER DEFAULT 0" + "," +
"rank INTEGER NOT NULL DEFAULT 0," +
"options INTEGER NOT NULL DEFAULT 0," +
"subType INTEGER DEFAULT 0" +
");");
addWorkspacesTable(db);
// Database was just created, so wipe any previous widgets
if (mAppWidgetHost != null) {
try {
mAppWidgetHost.deleteHost();
/**
* Send notification that we've deleted the {@link AppWidgetHost},
* probably as part of the initial database creation. The receiver may
* want to re-call {@link AppWidgetHost#startListening()} to ensure
* callbacks are correctly set.
*/
new MainThreadExecutor().execute(new Runnable() {
@Override
public void run() {
if (mListener != null) {
mListener.onAppWidgetHostReset();
}
}
});
} catch (NullPointerException ex) {
// nothing to do here. Why did this pass the null check? I don't know. but this fixes it.
// (avoids: Caused by: java.lang.NullPointerException: Attempt to invoke interface method
// 'void com.android.internal.appwidget.IAppWidgetService.deleteHost(java.lang.String, int)'
// on a null object reference
}
}
// Fresh and clean launcher DB.
mMaxItemId = initializeMaxItemId(db);
setFlagEmptyDbCreated();
// When a new DB is created, remove all previously stored managed profile information.
ManagedProfileHeuristic.processAllUsers(Collections.<UserHandleCompat>emptyList(),
mContext);
}