Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00c95b84 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing some obsolete callbacks

Change-Id: I3cf19a13ff145923f2973e23c24033f196324aa3
parent 4670ff6e
Loading
Loading
Loading
Loading
+1 −86
Original line number Diff line number Diff line
@@ -474,13 +474,6 @@ public class Launcher extends BaseActivity

    private LauncherCallbacks mLauncherCallbacks;

    public void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onPostCreate(savedInstanceState);
        }
    }

    public void onInsetsChanged(Rect insets) {
        mDeviceProfile.updateInsets(insets);
        mDeviceProfile.layout(this, true /* notifyListeners */);
@@ -845,9 +838,6 @@ public class Launcher extends BaseActivity
    @Override
    protected void onResume() {
        TraceHelper.beginSection("ON_RESUME");
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.preOnResume();
        }
        super.onResume();
        TraceHelper.partitionSection("ON_RESUME", "superCall");

@@ -868,9 +858,6 @@ public class Launcher extends BaseActivity
        }

        setOnResumeCallback(null);

        updateInteraction(Workspace.State.NORMAL, mWorkspace.getState());

        // Process any items that were added while Launcher was away.
        InstallShortcutReceiver.disableAndFlushInstallQueue(
                InstallShortcutReceiver.FLAG_ACTIVITY_PAUSED, this);
@@ -1500,11 +1487,7 @@ public class Launcher extends BaseActivity
        // as slow logic in the callbacks eat into the time the scroller expects for the snapToPage
        // animation.
        if (isActionMain) {
            boolean callbackAllowsMoveToDefaultScreen =
                mLauncherCallbacks == null || mLauncherCallbacks
                    .shouldMoveToDefaultScreenOnHomeIntent();
            if (shouldMoveToDefaultScreen && !mWorkspace.isTouchActive()
                    && callbackAllowsMoveToDefaultScreen) {
            if (shouldMoveToDefaultScreen && !mWorkspace.isTouchActive()) {

                mWorkspace.post(new Runnable() {
                    @Override
@@ -1711,25 +1694,11 @@ public class Launcher extends BaseActivity
    }

    private void setWorkspaceLoading(boolean value) {
        boolean isLocked = isWorkspaceLocked();
        mWorkspaceLoading = value;
        if (isLocked != isWorkspaceLocked()) {
            onWorkspaceLockedChanged();
        }
    }

    public void setWaitingForResult(PendingRequestArgs args) {
        boolean isLocked = isWorkspaceLocked();
        mPendingRequestArgs = args;
        if (isLocked != isWorkspaceLocked()) {
            onWorkspaceLockedChanged();
        }
    }

    protected void onWorkspaceLockedChanged() {
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onWorkspaceLockedChanged();
        }
    }

    void addAppWidgetFromDropImpl(int appWidgetId, ItemInfo info, AppWidgetHostView boundWidget,
@@ -2245,44 +2214,6 @@ public class Launcher extends BaseActivity
        mDragLayer.onAccessibilityStateChanged(enabled);
    }

    /**
     * Called when the user stops interacting with the launcher.
     * This implies that the user is now on the homescreen and is not doing housekeeping.
     */
    protected void onInteractionEnd() {
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onInteractionEnd();
        }
    }

    /**
     * Called when the user starts interacting with the launcher.
     * The possible interactions are:
     *  - open all apps
     *  - reorder an app shortcut, or a widget
     *  - open the overview mode.
     * This is a good time to stop doing things that only make sense
     * when the user is on the homescreen and not doing housekeeping.
     */
    protected void onInteractionBegin() {
        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onInteractionBegin();
        }
    }

    /** Updates the interaction state. */
    public void updateInteraction(Workspace.State fromState, Workspace.State toState) {
        // Only update the interacting state if we are transitioning to/from a view with an
        // overlay
        boolean fromStateWithOverlay = fromState != Workspace.State.NORMAL;
        boolean toStateWithOverlay = toState != Workspace.State.NORMAL;
        if (toStateWithOverlay) {
            onInteractionBegin();
        } else if (fromStateWithOverlay) {
            onInteractionEnd();
        }
    }

    private void startShortcutIntentSafely(Intent intent, Bundle optsBundle, ItemInfo info) {
        try {
            StrictMode.VmPolicy oldPolicy = StrictMode.getVmPolicy();
@@ -2683,18 +2614,6 @@ public class Launcher extends BaseActivity
        return true;
    }

    /**
     * Updates the workspace and interaction state on state change, and return the animation to this
     * new state.
     */
    public Animator startWorkspaceStateChangeAnimation(Workspace.State toState,
            boolean animated, AnimationLayerSet layerViews) {
        Workspace.State fromState = mWorkspace.getState();
        Animator anim = mWorkspace.setStateWithAnimation(toState, animated, layerViews);
        updateInteraction(fromState, toState);
        return anim;
    }

    public void enterSpringLoadedDragMode() {
        if (LOGD) Log.d(TAG, String.format("enterSpringLoadedDragMode [mState=%s", mState.name()));
        if (isStateSpringLoaded()) {
@@ -3273,10 +3192,6 @@ public class Launcher extends BaseActivity
                InstallShortcutReceiver.FLAG_LOADER_RUNNING, this);

        NotificationListener.setNotificationsChangedListener(mPopupDataProvider);

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.finishBindingItems(false);
        }
        TraceHelper.endSection("finishBindingItems");
    }

+0 −9
Original line number Diff line number Diff line
@@ -39,14 +39,12 @@ public interface LauncherCallbacks {
     */
    void preOnCreate();
    void onCreate(Bundle savedInstanceState);
    void preOnResume();
    void onResume();
    void onStart();
    void onStop();
    void onPause();
    void onDestroy();
    void onSaveInstanceState(Bundle outState);
    void onPostCreate(Bundle savedInstanceState);
    void onNewIntent(Intent intent);
    void onActivityResult(int requestCode, int resultCode, Intent data);
    void onRequestPermissionsResult(int requestCode, String[] permissions,
@@ -64,13 +62,7 @@ public interface LauncherCallbacks {
     * Extension points for providing custom behavior on certain user interactions.
     */
    void onLauncherProviderChange();
    void finishBindingItems(final boolean upgradePath);
    void bindAllApplications(ArrayList<AppInfo> apps);
    void onInteractionBegin();
    void onInteractionEnd();

    @Deprecated
    void onWorkspaceLockedChanged();

    /**
     * Starts a search with {@param initialQuery}. Return false if search was not started.
@@ -81,6 +73,5 @@ public interface LauncherCallbacks {
    /*
     * Extensions points for adding / replacing some other aspects of the Launcher experience.
     */
    boolean shouldMoveToDefaultScreenOnHomeIntent();
    boolean hasSettings();
}
+2 −2
Original line number Diff line number Diff line
@@ -361,8 +361,8 @@ public class LauncherStateTransitionAnimation {
            AnimationLayerSet layerViews) {
        // Create the workspace animation.
        // NOTE: this call apparently also sets the state for the workspace if !animated
        Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState,
                animated, layerViews);
        Animator workspaceAnim = mLauncher.getWorkspace().
                setStateWithAnimation(toWorkspaceState, animated, layerViews);

        if (animated && initialized) {
            // Play the workspace animation
+0 −2
Original line number Diff line number Diff line
@@ -402,7 +402,6 @@ public class Workspace extends PagedView

        updateChildrenLayersEnabled();
        mLauncher.lockScreenOrientation();
        mLauncher.onInteractionBegin();
        // Prevent any Un/InstallShortcutReceivers from updating the db while we are dragging
        InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_DRAG_AND_DROP);

@@ -462,7 +461,6 @@ public class Workspace extends PagedView

        mOutlineProvider = null;
        mDragSourceInternal = null;
        mLauncher.onInteractionEnd();
    }

    /**
+0 −29
Original line number Diff line number Diff line
@@ -35,10 +35,6 @@ public class LauncherExtension extends Launcher {
        public void onCreate(Bundle savedInstanceState) {
        }

        @Override
        public void preOnResume() {
        }

        @Override
        public void onResume() {
        }
@@ -63,10 +59,6 @@ public class LauncherExtension extends Launcher {
        public void onSaveInstanceState(Bundle outState) {
        }

        @Override
        public void onPostCreate(Bundle savedInstanceState) {
        }

        @Override
        public void onNewIntent(Intent intent) {
        }
@@ -110,37 +102,16 @@ public class LauncherExtension extends Launcher {
        public void onLauncherProviderChange() {
        }

        @Override
        public void finishBindingItems(boolean upgradePath) {
        }

        @Override
        public void bindAllApplications(ArrayList<AppInfo> apps) {
        }

        @Override
        public void onWorkspaceLockedChanged() {
        }

        @Override
        public void onInteractionBegin() {
        }

        @Override
        public void onInteractionEnd() {
        }

        @Override
        public boolean startSearch(String initialQuery, boolean selectInitialQuery,
                Bundle appSearchData) {
            return false;
        }

        @Override
        public boolean shouldMoveToDefaultScreenOnHomeIntent() {
            return true;
        }

        @Override
        public boolean hasSettings() {
            return false;