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

Commit f7dd9081 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Handling broader set of exceptions when startingActivity from Recents....

Merge "Handling broader set of exceptions when startingActivity from Recents. (Bug 17481968)" into lmp-dev
parents 6920feed 4e96eb70
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -670,6 +670,8 @@
    <string name="recents_lock_to_app_button_label">lock to app</string>
    <!-- Recents: Temporary string for the button in the recents search bar. [CHAR LIMIT=NONE] -->
    <string name="recents_search_bar_label">search</string>
    <!-- Recents: Launch error string. [CHAR LIMIT=NONE] -->
    <string name="recents_launch_error_message">Could not start <xliff:g id="app" example="Calendar">%s</xliff:g>.</string>


    <!-- Expanded Status Bar Header: Battery Charged [CHAR LIMIT=40] -->
+2 −3
Original line number Diff line number Diff line
@@ -222,9 +222,8 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
            // Bring an active task to the foreground
            mSystemServicesProxy.moveTaskToFront(toTask.key.id, launchOpts);
        } else {
            try {
                mSystemServicesProxy.startActivityFromRecents(toTask.key.id, launchOpts);
            } catch (ActivityNotFoundException anfe) {}
            mSystemServicesProxy.startActivityFromRecents(mContext, toTask.key.id,
                    toTask.activityLabel, launchOpts);
        }
    }

+6 −0
Original line number Diff line number Diff line
@@ -613,6 +613,12 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        mVisible = false;
    }

    @Override
    public void onTaskLaunchFailed() {
        // Return to Home
        dismissRecentsToHomeRaw(true);
    }

    @Override
    public void onAllTaskViewsDismissed() {
        mFinishLaunchHomeRunnable.run();
+9 −2
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import android.view.DisplayInfo;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import com.android.systemui.R;
import com.android.systemui.recents.Constants;

import java.io.IOException;
@@ -515,12 +516,18 @@ public class SystemServicesProxy {
        return takeScreenshot();
    }

    public void startActivityFromRecents(int taskId, ActivityOptions options) {
    /** Starts an activity from recents. */
    public boolean startActivityFromRecents(Context context, int taskId, String taskName,
            ActivityOptions options) {
        if (mIam != null) {
            try {
                mIam.startActivityFromRecents(taskId, options == null ? null : options.toBundle());
            } catch (RemoteException e) {
                return true;
            } catch (Exception e) {
                Console.logError(context,
                        context.getString(R.string.recents_launch_error_message, taskName));
            }
        }
        return false;
    }
}
+10 −4
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
    /** The RecentsView callbacks */
    public interface RecentsViewCallbacks {
        public void onTaskViewClicked();
        public void onTaskLaunchFailed();
        public void onAllTaskViewsDismissed();
        public void onExitToHomeAnimationTriggered();
    }
@@ -471,13 +472,18 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
                    // Bring an active task to the foreground
                    ssp.moveTaskToFront(task.key.id, launchOpts);
                } else {
                    try {
                        ssp.startActivityFromRecents(task.key.id, launchOpts);
                    if (ssp.startActivityFromRecents(getContext(), task.key.id,
                            task.activityLabel, launchOpts)) {
                        if (launchOpts == null && lockToTask) {
                            ssp.lockCurrentTask();
                        }
                    } catch (ActivityNotFoundException anfe) {
                        Console.logError(getContext(), "Could not start Activity");
                    } else {
                        // Dismiss the task and return the user to home if we fail to
                        // launch the task
                        onTaskViewDismissed(task);
                        if (mCb != null) {
                            mCb.onTaskLaunchFailed();
                        }
                    }
                }
            }