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

Commit 35ad9d86 authored by Jorim Jaggi's avatar Jorim Jaggi Committed by android-build-merger
Browse files

Don\'t crash the system when detecting a transient wrong state

am: f970410a

* commit 'f970410a':
  Don't crash the system when detecting a transient wrong state

Change-Id: Ic66745a59761e34b9b5e37651ee3cf4c0022b26e
parents 5f955042 f970410a
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -5,12 +5,15 @@ import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.ActivityStack.STACK_INVISIBLE;
import static com.android.server.am.ActivityStack.STACK_INVISIBLE;


import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.ActivityManager.StackId;
import android.app.ActivityManager.StackId;
import android.content.Context;
import android.content.Context;
import android.os.SystemClock;
import android.os.SystemClock;
import android.util.Slog;


import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.logging.MetricsProto.MetricsEvent;
@@ -19,6 +22,9 @@ import com.android.internal.logging.MetricsProto.MetricsEvent;
 * Handles logging into Tron.
 * Handles logging into Tron.
 */
 */
class ActivityMetricsLogger {
class ActivityMetricsLogger {

    private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityMetricsLogger" : TAG_AM;

    // Window modes we are interested in logging. If we ever introduce a new type, we need to add
    // Window modes we are interested in logging. If we ever introduce a new type, we need to add
    // a value here and increase the {@link #TRON_WINDOW_STATE_VARZ_STRINGS} array.
    // a value here and increase the {@link #TRON_WINDOW_STATE_VARZ_STRINGS} array.
    private static final int WINDOW_STATE_STANDARD = 0;
    private static final int WINDOW_STATE_STANDARD = 0;
@@ -74,8 +80,9 @@ class ActivityMetricsLogger {
                || stack.mStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
                || stack.mStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
            mWindowState = WINDOW_STATE_STANDARD;
            mWindowState = WINDOW_STATE_STANDARD;
        } else if (stack.mStackId == DOCKED_STACK_ID) {
        } else if (stack.mStackId == DOCKED_STACK_ID) {
            throw new IllegalStateException("Docked stack shouldn't be the focused stack, "
            Slog.wtf(TAG, "Docked stack shouldn't be the focused stack, because it reported not"
                    + "because it reported not being visible.");
                    + " being visible.");
            mWindowState = WINDOW_STATE_INVALID;
        } else if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
        } else if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
            mWindowState = WINDOW_STATE_FREEFORM;
            mWindowState = WINDOW_STATE_FREEFORM;
        } else if (StackId.isStaticStack(stack.mStackId)) {
        } else if (StackId.isStaticStack(stack.mStackId)) {