Long press to add a widget, combined with the recentUI interface, the widget adding process is interrupted, resulting in various abnormal problems

Time:
Before 2021/04/19, the company does not allow csdn, and the notes are written elsewhere. recently tidied up

Bug description

1. Long press setting to add widget, click the recentUI button on the widget selection interface to return to the launcher, the desktop icon cannot be long pressed again

Repair plan

packages/apps/Launcher3/src/com/android/launcher3/Launcher.java

     public boolean isWorkspaceLocked() {
    
    
-        return mWorkspaceLoading || mPendingRequestArgs != null;
+        return mWorkspaceLoading;// || mPendingRequestArgs != null;
     }

bug description

2. Press and hold Gmail, select the first plug-in and drag it to the desktop, click the recentUI button on the folder selection interface, and return to the launcher desktop. The afterimage of Gmail cannot be eliminated

Repair plan

--- a/alps/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
+++ b/alps/packages/apps/Launcher3/src/com/android/launcher3/Launcher.java
@@ -676,7 +676,11 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
         Runnable exitSpringLoaded = new Runnable() {
    
    
             @Override
             public void run() {
    
    
-                mStateManager.goToState(NORMAL, SPRING_LOADED_EXIT_DELAY);
+                if(changeState){
    
    
+                    mStateManager.goToState(NORMAL, SPRING_LOADED_EXIT_DELAY);
+                }else{
    
    
+                    changeState = true;
+                }
             }
         };
@@ -720,7 +724,11 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
                 final Runnable onComplete = new Runnable() {
    
    
                     @Override
                     public void run() {
    
    
-                        getStateManager().goToState(NORMAL);
+                        if(changeState){
    
    
+                            getStateManager().goToState(NORMAL);
+                        }else{
    
    
+                            changeState = true;
+                        }
                     }
                 };
@@ -901,6 +909,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
         mAppWidgetHost.setListenIfResumed(true);
         RaceConditionTracker.onEvent(ON_START_EVT, EXIT);
     }
+    boolean changeState = true;
     private void handleDeferredResume() {
    
    
         if (hasBeenResumed() && !mStateManager.getState().disableInteraction) {
    
    
@@ -923,8 +932,22 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
             DiscoveryBounce.showForHomeIfNeeded(this);
-            if (mPendingActivityRequestCode != -1 && isInState(NORMAL)) {
    
    
-                UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+            if (mPendingActivityRequestCode != -1) {
    
    
+                if(isInState(NORMAL)) {
    
    
+                    //changeState
+                    //clear widget data and flag
+                    //clearAnimatedView and start Launcher to clearTask
+                    changeState = true;
+                    UiFactory.resetPendingActivityResults(this, mPendingActivityRequestCode);
+                }else{
    
    
+                    //it's google issue from the recent ui
+                    //widget-->recent-->normal/allapp
+                    //i should clear widget data and flag
+                    //don't changeState
+                    //don't start Launcher to clearTask
+                    changeState = false;
+                    onActivityResult(mPendingActivityRequestCode, RESULT_CANCELED, null);
+                }
             }
             mDeferredResumePending = false;
         } else {
    
    

Guess you like

Origin blog.csdn.net/a396604593/article/details/129796557