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

Commit 4346f0a1 authored by Steven Timotius's avatar Steven Timotius
Browse files

Convert ActivityManager dumpsys to protobuf

Also adding ActivityInfo.RESIZE_MODE_RESIZEABLE to TestApi

Test: cts-tradefed run commandAndExit cts-dev --module CtsActivityManagerDeviceTestCases

Change-Id: I958aa155b266799840ece1ca07feed8593724449
parent afb22390
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -10199,6 +10199,7 @@ package android.content.pm {
    field public static final int PERSIST_ACROSS_REBOOTS = 2; // 0x2
    field public static final int PERSIST_NEVER = 1; // 0x1
    field public static final int PERSIST_ROOT_ONLY = 0; // 0x0
    field public static final int RESIZE_MODE_RESIZEABLE = 2; // 0x2
    field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3
    field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa
    field public static final int SCREEN_ORIENTATION_FULL_USER = 13; // 0xd
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.content.pm;

import android.annotation.IntDef;
import android.annotation.TestApi;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Configuration.NativeConfig;
@@ -180,6 +181,7 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
     * Activity explicitly requested to be resizeable.
     * @hide
     */
    @TestApi
    public static final int RESIZE_MODE_RESIZEABLE = 2;
    /**
     * Activity is resizeable and supported picture-in-picture mode.  This flag is now deprecated
+84 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto3";

import "frameworks/base/core/proto/android/server/windowmanagerservice.proto";
import "frameworks/base/core/proto/android/graphics/rect.proto";

package com.android.server.am.proto;

option java_multiple_files = true;

message ActivityManagerServiceProto {
  ActivityStackSupervisorProto activities = 1;
}

message ActivityStackSupervisorProto {
  .com.android.server.wm.proto.ConfigurationContainerProto configuration_container = 1;
  repeated ActivityDisplayProto displays = 2;
  KeyguardControllerProto keyguard_controller = 3;
  int32 focused_stack_id = 4;
  .com.android.server.wm.proto.IdentifierProto resumed_activity = 5;
}

/* represents ActivityStackSupervisor.ActivityDisplay */
message ActivityDisplayProto {
  .com.android.server.wm.proto.ConfigurationContainerProto configuration_container = 1;
  int32 id = 2;
  repeated ActivityStackProto stacks = 3;
}

message ActivityStackProto {
  .com.android.server.wm.proto.ConfigurationContainerProto configuration_container = 1;
  int32 id = 2;
  repeated TaskRecordProto tasks = 3;
  .com.android.server.wm.proto.IdentifierProto resumed_activity = 4;
  int32 display_id = 5;
  bool fullscreen = 6;
  .android.graphics.RectProto bounds = 7;
}

message TaskRecordProto {
  .com.android.server.wm.proto.ConfigurationContainerProto configuration_container = 1;
  int32 id = 2;
  repeated ActivityRecordProto activities = 3;
  int32 stack_id = 4;
  .android.graphics.RectProto last_non_fullscreen_bounds = 5;
  string real_activity = 6;
  string orig_activity = 7;
  int32 activity_type = 8;
  int32 return_to_type = 9;
  int32 resize_mode = 10;
  bool fullscreen = 11;
  .android.graphics.RectProto bounds = 12;
  int32 min_width = 13;
  int32 min_height = 14;
}

message ActivityRecordProto {
  .com.android.server.wm.proto.ConfigurationContainerProto configuration_container = 1;
  .com.android.server.wm.proto.IdentifierProto identifier = 2;
  string state = 3;
  bool visible = 4;
  bool front_of_task = 5;
  int32 proc_id = 6;
}

message KeyguardControllerProto {
  bool keyguard_showing = 1;
  bool keyguard_occluded = 2;
}
 No newline at end of file
+21 −2
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_CLEANUP;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_FOCUS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_IMMERSIVE;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKSCREEN;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LOCKTASK;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_LRU;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_MU;
@@ -163,7 +162,6 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_SWITCH;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_UID_OBSERVERS;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_URI_PERMISSION;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBILITY;
import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_VISIBLE_BEHIND;
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.ActivityStackSupervisor.CREATE_IF_NEEDED;
@@ -177,6 +175,7 @@ import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK;
import static com.android.server.am.TaskRecord.REPARENT_KEEP_STACK_AT_FRONT;
import static com.android.server.am.TaskRecord.REPARENT_LEAVE_STACK_IN_PLACE;
import static com.android.server.am.proto.ActivityManagerServiceProto.ACTIVITIES;
import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_OPEN;
import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_RELAUNCH;
import static com.android.server.wm.AppTransition.TRANSIT_NONE;
@@ -349,6 +348,7 @@ import android.util.SparseArray;
import android.util.SparseIntArray;
import android.util.TimeUtils;
import android.util.Xml;
import android.util.proto.ProtoOutputStream;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -14801,6 +14801,7 @@ public class ActivityManagerService extends IActivityManager.Stub
        boolean dumpCheckinFormat = false;
        boolean dumpVisibleStacksOnly = false;
        boolean dumpFocusedStackOnly = false;
        boolean useProto = false;
        String dumpPackage = null;
        int opti = 0;
@@ -14834,12 +14835,26 @@ public class ActivityManagerService extends IActivityManager.Stub
            } else if ("-h".equals(opt)) {
                ActivityManagerShellCommand.dumpHelp(pw, true);
                return;
            } else if ("--proto".equals(opt)) {
                useProto = true;
            } else {
                pw.println("Unknown argument: " + opt + "; use -h for help");
            }
        }
        long origId = Binder.clearCallingIdentity();
        if (useProto) {
            //TODO: Options when dumping proto
            final ProtoOutputStream proto = new ProtoOutputStream(fd);
            synchronized (this) {
                writeActivitiesToProtoLocked(proto);
            }
            proto.flush();
            Binder.restoreCallingIdentity(origId);
            return;
        }
        boolean more = false;
        // Is the caller requesting to dump a particular piece of data?
        if (opti < args.length) {
@@ -15183,6 +15198,10 @@ public class ActivityManagerService extends IActivityManager.Stub
        Binder.restoreCallingIdentity(origId);
    }
    private void writeActivitiesToProtoLocked(ProtoOutputStream proto) {
        mStackSupervisor.writeToProto(proto, ACTIVITIES);
    }
    private void dumpLastANRLocked(PrintWriter pw) {
        pw.println("ACTIVITY MANAGER LAST ANR (dumpsys activity lastanr)");
        if (mLastANRState == null) {
+1 −0
Original line number Diff line number Diff line
@@ -2675,6 +2675,7 @@ final class ActivityManagerShellCommand extends ShellCommand {
            pw.println("  -p: limit output to given package.");
            pw.println("  --checkin: output checkin format, resetting data.");
            pw.println("  --C: output checkin format, not resetting data.");
            pw.println("  --proto: output dump in protocol buffer format.");
        } else {
            pw.println("Activity manager (activity) commands:");
            pw.println("  help");
Loading