use of com.android.launcher3.util.RaceConditionTracker.ENTER in project Neo-Launcher by NeoApplications.
the class Launcher method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
RaceConditionTracker.onEvent(ON_CREATE_EVT, ENTER);
if (DEBUG_STRICT_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());
}
TraceHelper.beginSection("Launcher-onCreate");
super.onCreate(savedInstanceState);
TraceHelper.partitionSection("Launcher-onCreate", "super call");
LauncherAppState app = LauncherAppState.getInstance(this);
OmegaPreferences prefs = Utilities.getOmegaPrefs(this);
prefs.getDrawerGridSize();
prefs.getGridSize();
prefs.getDockGridSize();
mOldConfig = new Configuration(getResources().getConfiguration());
mModel = app.setLauncher(this);
mRotationHelper = new RotationHelper(this);
InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
initDeviceProfile(idp);
idp.addOnChangeListener(this);
mSharedPrefs = Utilities.getPrefs(this);
mIconCache = app.getIconCache();
mAccessibilityDelegate = new LauncherAccessibilityDelegate(this);
mDragController = new DragController(this);
mAllAppsController = new AllAppsTransitionController(this);
mStateManager = new LauncherStateManager(this);
UiFactory.onCreate(this);
mAppWidgetManager = AppWidgetManagerCompat.getInstance(this);
mAppWidgetHost = new LauncherAppWidgetHost(this, appWidgetId -> getWorkspace().removeWidget(appWidgetId));
mAppWidgetHost.startListening();
mLauncherView = LayoutInflater.from(this).inflate(R.layout.launcher, null);
setupViews();
mPopupDataProvider = new PopupDataProvider(this);
mAppTransitionManager = LauncherAppTransitionManager.newInstance(this);
boolean internalStateHandled = InternalStateHandler.handleCreate(this, getIntent());
if (internalStateHandled) {
if (savedInstanceState != null) {
// InternalStateHandler has already set the appropriate state.
// We dont need to do anything.
savedInstanceState.remove(RUNTIME_STATE);
}
}
restoreState(savedInstanceState);
mStateManager.reapplyState();
// We only load the page synchronously if the user rotates (or triggers a
// configuration change) while launcher is in the foreground
int currentScreen = PagedView.INVALID_RESTORE_PAGE;
if (savedInstanceState != null) {
currentScreen = savedInstanceState.getInt(RUNTIME_STATE_CURRENT_SCREEN, currentScreen);
}
if (!mModel.startLoader(currentScreen)) {
if (!internalStateHandled) {
// If we are not binding synchronously, show a fade in animation when
// the first page bind completes.
mDragLayer.getAlphaProperty(ALPHA_INDEX_LAUNCHER_LOAD).setValue(0);
}
} else {
// Pages bound synchronously.
mWorkspace.setCurrentPage(currentScreen);
setWorkspaceLoading(true);
}
// For handling default keys
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
setContentView(mLauncherView);
getRootView().dispatchInsets();
// Listen for broadcasts
registerReceiver(mScreenOffReceiver, new IntentFilter(Intent.ACTION_SCREEN_OFF));
getSystemUiController().updateUiState(SystemUiController.UI_STATE_BASE_WINDOW, Themes.getAttrBoolean(this, R.attr.isWorkspaceDarkText));
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onCreate(savedInstanceState);
}
mRotationHelper.initialize();
TraceHelper.endSection("Launcher-onCreate");
RaceConditionTracker.onEvent(ON_CREATE_EVT, EXIT);
mStateManager.addStateListener(new LauncherStateManager.StateListener() {
@Override
public void onStateTransitionStart(LauncherState toState) {
}
@Override
public void onStateTransitionComplete(LauncherState finalState) {
float alpha = 1f - mCurrentAssistantVisibility;
if (finalState == NORMAL) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
} else if (finalState == OVERVIEW || finalState == OVERVIEW_PEEK) {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(alpha);
} else {
mAppsView.getAlphaProperty(APPS_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
mScrimView.getAlphaProperty(SCRIM_VIEW_ALPHA_CHANNEL_INDEX).setValue(1f);
}
}
});
}
use of com.android.launcher3.util.RaceConditionTracker.ENTER in project android_packages_apps_Launcher3 by ProtonAOSP.
the class Workspace method onDragStart.
@Override
public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
if (mDragInfo != null && mDragInfo.cell != null) {
CellLayout layout = (CellLayout) (mDragInfo.cell instanceof LauncherAppWidgetHostView ? dragObject.dragView.getContentViewParent().getParent() : mDragInfo.cell.getParent().getParent());
layout.markCellsAsUnoccupiedForView(mDragInfo.cell);
}
updateChildrenLayersEnabled();
// Do not add a new page if it is a accessible drag which was not started by the workspace.
// We do not support accessibility drag from other sources and instead provide a direct
// action for move/add to homescreen.
// When a accessible drag is started by the folder, we only allow rearranging withing the
// folder.
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
if (addNewPage) {
mDeferRemoveExtraEmptyScreen = false;
addExtraEmptyScreenOnDrag(dragObject);
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET && dragObject.dragSource != this) {
// When dragging a widget from different source, move to a page which has
// enough space to place this widget (after rearranging/resizing). We special case
// widgets as they cannot be placed inside a folder.
// Start at the current page and search right (on LTR) until finding a page with
// enough space. Since an empty screen is the furthest right, a page must be found.
int currentPage = getDestinationPage();
for (int pageIndex = currentPage; pageIndex < getPageCount(); pageIndex++) {
CellLayout page = (CellLayout) getPageAt(pageIndex);
if (page.hasReorderSolution(dragObject.dragInfo)) {
setCurrentPage(pageIndex);
break;
}
}
}
}
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.logger().withItemInfo(dragObject.dragInfo).withInstanceId(dragObject.logInstanceId).log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
}
use of com.android.launcher3.util.RaceConditionTracker.ENTER in project android_packages_apps_404Launcher by P-404.
the class Workspace method onDragStart.
@Override
public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
if (mDragInfo != null && mDragInfo.cell != null) {
CellLayout layout = (CellLayout) (mDragInfo.cell instanceof LauncherAppWidgetHostView ? dragObject.dragView.getContentViewParent().getParent() : mDragInfo.cell.getParent().getParent());
layout.markCellsAsUnoccupiedForView(mDragInfo.cell);
}
updateChildrenLayersEnabled();
// Do not add a new page if it is a accessible drag which was not started by the workspace.
// We do not support accessibility drag from other sources and instead provide a direct
// action for move/add to homescreen.
// When a accessible drag is started by the folder, we only allow rearranging withing the
// folder.
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
if (addNewPage) {
mDeferRemoveExtraEmptyScreen = false;
addExtraEmptyScreenOnDrag(dragObject);
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET && dragObject.dragSource != this) {
// When dragging a widget from different source, move to a page which has
// enough space to place this widget (after rearranging/resizing). We special case
// widgets as they cannot be placed inside a folder.
// Start at the current page and search right (on LTR) until finding a page with
// enough space. Since an empty screen is the furthest right, a page must be found.
int currentPage = getDestinationPage();
for (int pageIndex = currentPage; pageIndex < getPageCount(); pageIndex++) {
CellLayout page = (CellLayout) getPageAt(pageIndex);
if (page.hasReorderSolution(dragObject.dragInfo)) {
setCurrentPage(pageIndex);
break;
}
}
}
}
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.logger().withItemInfo(dragObject.dragInfo).withInstanceId(dragObject.logInstanceId).log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
}
use of com.android.launcher3.util.RaceConditionTracker.ENTER in project android_packages_apps_Launcher3 by crdroidandroid.
the class Workspace method onDragStart.
@Override
public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
if (mDragInfo != null && mDragInfo.cell != null) {
CellLayout layout = (CellLayout) (mDragInfo.cell instanceof LauncherAppWidgetHostView ? dragObject.dragView.getContentViewParent().getParent() : mDragInfo.cell.getParent().getParent());
layout.markCellsAsUnoccupiedForView(mDragInfo.cell);
}
updateChildrenLayersEnabled();
// Do not add a new page if it is a accessible drag which was not started by the workspace.
// We do not support accessibility drag from other sources and instead provide a direct
// action for move/add to homescreen.
// When a accessible drag is started by the folder, we only allow rearranging withing the
// folder.
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
if (addNewPage) {
mDeferRemoveExtraEmptyScreen = false;
addExtraEmptyScreenOnDrag(dragObject);
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET && dragObject.dragSource != this) {
// When dragging a widget from different source, move to a page which has
// enough space to place this widget (after rearranging/resizing). We special case
// widgets as they cannot be placed inside a folder.
// Start at the current page and search right (on LTR) until finding a page with
// enough space. Since an empty screen is the furthest right, a page must be found.
int currentPage = getDestinationPage();
for (int pageIndex = currentPage; pageIndex < getPageCount(); pageIndex++) {
CellLayout page = (CellLayout) getPageAt(pageIndex);
if (page.hasReorderSolution(dragObject.dragInfo)) {
setCurrentPage(pageIndex);
break;
}
}
}
}
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.logger().withItemInfo(dragObject.dragInfo).withInstanceId(dragObject.logInstanceId).log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
}
use of com.android.launcher3.util.RaceConditionTracker.ENTER in project android_packages_apps_Launcher3 by ArrowOS.
the class Workspace method onDragStart.
@Override
public void onDragStart(DragObject dragObject, DragOptions options) {
if (ENFORCE_DRAG_EVENT_ORDER) {
enforceDragParity("onDragStart", 0, 0);
}
if (mDragInfo != null && mDragInfo.cell != null) {
CellLayout layout = (CellLayout) (mDragInfo.cell instanceof LauncherAppWidgetHostView ? dragObject.dragView.getContentViewParent().getParent() : mDragInfo.cell.getParent().getParent());
layout.markCellsAsUnoccupiedForView(mDragInfo.cell);
}
updateChildrenLayersEnabled();
// Do not add a new page if it is a accessible drag which was not started by the workspace.
// We do not support accessibility drag from other sources and instead provide a direct
// action for move/add to homescreen.
// When a accessible drag is started by the folder, we only allow rearranging withing the
// folder.
boolean addNewPage = !(options.isAccessibleDrag && dragObject.dragSource != this);
if (addNewPage) {
mDeferRemoveExtraEmptyScreen = false;
addExtraEmptyScreenOnDrag(dragObject);
if (dragObject.dragInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET && dragObject.dragSource != this) {
// When dragging a widget from different source, move to a page which has
// enough space to place this widget (after rearranging/resizing). We special case
// widgets as they cannot be placed inside a folder.
// Start at the current page and search right (on LTR) until finding a page with
// enough space. Since an empty screen is the furthest right, a page must be found.
int currentPage = getDestinationPage();
for (int pageIndex = currentPage; pageIndex < getPageCount(); pageIndex++) {
CellLayout page = (CellLayout) getPageAt(pageIndex);
if (page.hasReorderSolution(dragObject.dragInfo)) {
setCurrentPage(pageIndex);
break;
}
}
}
}
// Always enter the spring loaded mode
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.logger().withItemInfo(dragObject.dragInfo).withInstanceId(dragObject.logInstanceId).log(LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
}
Aggregations