本文整理汇总了Java中com.android.launcher3.util.ManagedProfileHeuristic.processAllUsers方法的典型用法代码示例。如果您正苦于以下问题:Java ManagedProfileHeuristic.processAllUsers方法的具体用法?Java ManagedProfileHeuristic.processAllUsers怎么用?Java ManagedProfileHeuristic.processAllUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.launcher3.util.ManagedProfileHeuristic
的用法示例。
在下文中一共展示了ManagedProfileHeuristic.processAllUsers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}