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

Commit 23ac9cb3 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Calling start/stop listening in onStart/onStop

AppWidgetHost in N was changed to make start/stop lisenting calls
light weight, which allows launcher to avoid getting unnecessary
updates when its not visible

Bug: 23892701
Change-Id: I0ca6e02400992bc4e0359e45a3d66b9252751402
parent b8b070c2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -963,6 +963,9 @@ public class Launcher extends Activity
    protected void onStop() {
        super.onStop();
        FirstFrameAnimatorHelper.setIsVisible(false);
        if (Utilities.isNycOrAbove()) {
            mAppWidgetHost.stopListening();
        }

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onStop();
@@ -973,6 +976,9 @@ public class Launcher extends Activity
    protected void onStart() {
        super.onStart();
        FirstFrameAnimatorHelper.setIsVisible(true);
        if (Utilities.isNycOrAbove()) {
            mAppWidgetHost.startListening();
        }

        if (mLauncherCallbacks != null) {
            mLauncherCallbacks.onStart();
+0 −6
Original line number Diff line number Diff line
@@ -82,12 +82,6 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
        }
    }

    @Override
    public void stopListening() {
        super.stopListening();
        clearViews();
    }

    public void addProviderChangeListener(Runnable callback) {
        mProviderChangeListeners.add(callback);
    }