Merge "incidentd: Updating PowerManagerService proto files."

This commit is contained in:
TreeHugger Robot
2017-10-26 01:30:29 +00:00
committed by Android (Google) Code Review
14 changed files with 382 additions and 208 deletions

View File

@@ -501,7 +501,7 @@ public class ActivityManager {
public static final int PROCESS_STATE_SERVICE = 11;
/** @hide Process is in the background running a receiver. Note that from the
* perspective of oom_adj receivers run at a higher foreground level, but for our
* perspective of oom_adj, receivers run at a higher foreground level, but for our
* prioritization here that is not necessary and putting them below services means
* many fewer changes in some process states as they receive broadcasts. */
public static final int PROCESS_STATE_RECEIVER = 12;
@@ -525,6 +525,20 @@ public class ActivityManager {
/** @hide Process does not exist. */
public static final int PROCESS_STATE_NONEXISTENT = 18;
// NOTE: If PROCESS_STATEs are added or changed, then new fields must be added
// to frameworks/base/core/proto/android/app/activitymanager.proto and the following method must
// be updated to correctly map between them.
/**
* Maps ActivityManager.PROCESS_STATE_ values to ActivityManagerProto.ProcessState enum.
*
* @param amInt a process state of the form ActivityManager.PROCESS_STATE_
* @return the value of the corresponding android.app.ActivityManagerProto's ProcessState enum.
* @hide
*/
public static final int processStateAmToProto(int amInt) {
return amInt * 100;
}
/** @hide The lowest process state number */
public static final int MIN_PROCESS_STATE = PROCESS_STATE_PERSISTENT;

View File

@@ -0,0 +1,80 @@
/*
* 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 = "proto2";
package android.app;
option java_multiple_files = true;
message ActivityManagerProto {
// ActivityManager.java PROCESS_STATEs
enum ProcessState {
// Order matters for process states, so values have been spaced to provide
// room for future additions.
// Not a real process state.
PROCESS_STATE_UNKNOWN = -100;
// Process is a persistent system process.
PROCESS_STATE_PERSISTENT = 0;
// Process is a persistent system process and is doing UI.
PROCESS_STATE_PERSISTENT_UI = 100;
// Process is hosting the current top activities. Note that this covers
// all activities that are visible to the user.
PROCESS_STATE_TOP = 200;
// Process is hosting a foreground service due to a system binding.
PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 300;
// Process is hosting a foreground service.
PROCESS_STATE_FOREGROUND_SERVICE = 400;
// Same as PROCESS_STATE_TOP but while device is sleeping.
PROCESS_STATE_TOP_SLEEPING = 500;
// Process is important to the user, and something they are aware of.
PROCESS_STATE_IMPORTANT_FOREGROUND = 600;
// Process is important to the user, but not something they are aware of.
PROCESS_STATE_IMPORTANT_BACKGROUND = 700;
// Process is in the background transient so we will try to keep running.
PROCESS_STATE_TRANSIENT_BACKGROUND = 800;
// Process is in the background running a backup/restore operation.
PROCESS_STATE_BACKUP = 900;
// Process is in the background, but it can't restore its state so we want
// to try to avoid killing it.
PROCESS_STATE_HEAVY_WEIGHT = 1000;
// Process is in the background running a service. Unlike oom_adj, this
// level is used for both the normal running in background state and the
// executing operations state.
PROCESS_STATE_SERVICE = 1100;
// Process is in the background running a receiver. Note that from the
// perspective of oom_adj, receivers run at a higher foreground level, but
// for our prioritization here that is not necessary and putting them
// below services means many fewer changes in some process states as they
// receive broadcasts.
PROCESS_STATE_RECEIVER = 1200;
// Process is in the background but hosts the home activity.
PROCESS_STATE_HOME = 1300;
// Process is in the background but hosts the last shown activity.
PROCESS_STATE_LAST_ACTIVITY = 1400;
// Process is being cached for later use and contains activities.
PROCESS_STATE_CACHED_ACTIVITY = 1500;
// Process is being cached for later use and is a client of another cached
// process that contains activities.
PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 1600;
// Process is being cached for later use and is empty.
PROCESS_STATE_CACHED_EMPTY = 1700;
// Process does not exist.
PROCESS_STATE_NONEXISTENT = 1800;
}
}

View File

@@ -15,15 +15,37 @@
*/
syntax = "proto2";
package android.content;
option java_package = "android.content";
option java_multiple_files = true;
import "frameworks/base/core/proto/android/os/patternmatcher.proto";
package android.content;
// Next Tag: 13
message IntentProto {
enum DockState {
// Used as an int value for Intent#EXTRA_DOCK_STATE to represent that
// the phone is not in any dock.
DOCK_STATE_UNDOCKED = 0;
// Used as an int value for Intent#EXTRA_DOCK_STATE to represent that
// the phone is in a desk dock.
DOCK_STATE_DESK = 1;
// Used as an int value for Intent#EXTRA_DOCK_STATE to represent that
// the phone is in a car dock.
DOCK_STATE_CAR = 2;
// Used as an int value for Intent#EXTRA_DOCK_STATE to represent that
// the phone is in a analog (low end) dock.
DOCK_STATE_LE_DESK = 3;
// Used as an int value for Intent#EXTRA_DOCK_STATE to represent that
// the phone is in a digital (high end) dock.
DOCK_STATE_HE_DESK = 4;
}
optional string action = 1;
repeated string categories = 2;
optional string data = 3;

View File

@@ -0,0 +1,29 @@
/*
* 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 = "proto2";
package android.os;
option java_multiple_files = true;
message BatteryManagerProto {
enum PlugType {
PLUG_TYPE_NONE = 0;
PLUG_TYPE_AC = 1;
PLUG_TYPE_USB = 2;
PLUG_TYPE_WIRELESS = 4;
}
}

View File

@@ -20,6 +20,7 @@ option java_outer_classname = "IncidentProtoMetadata";
import "frameworks/base/libs/incident/proto/android/privacy.proto";
import "frameworks/base/libs/incident/proto/android/section.proto";
import "frameworks/base/core/proto/android/server/powermanagerservice.proto";
import "frameworks/base/core/proto/android/service/appwidget.proto";
import "frameworks/base/core/proto/android/service/battery.proto";
import "frameworks/base/core/proto/android/service/batterystats.proto";
@@ -28,7 +29,6 @@ import "frameworks/base/core/proto/android/service/diskstats.proto";
import "frameworks/base/core/proto/android/service/netstats.proto";
import "frameworks/base/core/proto/android/service/notification.proto";
import "frameworks/base/core/proto/android/service/package.proto";
import "frameworks/base/core/proto/android/service/power.proto";
import "frameworks/base/core/proto/android/service/print.proto";
import "frameworks/base/core/proto/android/service/procstats.proto";
import "frameworks/base/core/proto/android/server/activitymanagerservice.proto";
@@ -106,7 +106,11 @@ message IncidentProto {
(section).args = "package --proto"
];
optional android.service.power.PowerServiceDumpProto power = 3009;
optional com.android.server.power.PowerManagerServiceDumpProto power = 3009 [
(section).type = SECTION_DUMPSYS,
(section).args = "power --proto"
];
optional android.service.print.PrintServiceDumpProto print = 3010;
optional android.service.procstats.ProcessStatsServiceDumpProto procstats = 3011 [

View File

@@ -15,10 +15,10 @@
*/
syntax = "proto2";
option java_multiple_files = true;
package android.os;
option java_multiple_files = true;
message PowerManagerProto {
/* User activity events in PowerManager.java. */
enum UserActivityEvent {
@@ -31,4 +31,84 @@ message PowerManagerProto {
// Accessibility taking action on behalf of user.
USER_ACTIVITY_EVENT_ACCESSIBILITY = 3;
}
enum WakeLockLevel {
// NOTE: Wake lock levels were previously defined as a bit field, except
// that only a few combinations were actually supported so the bit field
// was removed. This explains why the numbering scheme is so odd. If
// adding a new wake lock level, any unused value can be used.
// Ensures that the CPU is running; the screen and keyboard backlight
// will be allowed to go off.
PARTIAL_WAKE_LOCK = 1;
// Ensures that the screen is on (but may be dimmed); the keyboard
// backlight will be allowed to go off. If the user presses the power
// button, then the SCREEN_DIM_WAKE_LOCK will be implicitly released by
// the system, causing both the screen and the CPU to be turned off.
SCREEN_DIM_WAKE_LOCK = 6 [deprecated = true];
// Ensures that the screen is on at full brightness; the keyboard
// backlight will be allowed to go off. If the user presses the power
// button, then the SCREEN_BRIGHT_WAKE_LOCK will be implicitly released
// by the system, causing both the screen and the CPU to be turned off.
SCREEN_BRIGHT_WAKE_LOCK = 10 [deprecated = true];
// Ensures that the screen and keyboard backlight are on at full
// brightness. If the user presses the power button, then the
// FULL_WAKE_LOCK will be implicitly released by the system, causing
// both the screen and the CPU to be turned off.
FULL_WAKE_LOCK = 26 [deprecated = true];
// Turns the screen off when the proximity sensor activates. If the
// proximity sensor detects that an object is nearby, the screen turns
// off immediately. Shortly after the object moves away, the screen
// turns on again.
// A proximity wake lock does not prevent the device from falling asleep
// unlike FULL_WAKE_LOCK, SCREEN_BRIGHT_WAKE_LOCK and
// SCREEN_DIM_WAKE_LOCK. If there is no user activity and no other wake
// locks are held, then the device will fall asleep (and lock) as usual.
// However, the device will not fall asleep while the screen has been
// turned off by the proximity sensor because it effectively counts as
// ongoing user activity.
PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
// Put the screen in a low power state and allow the CPU to suspend if
// no other wake locks are held. This is used by the dream manager to
// implement doze mode. It currently has no effect unless the power
// manager is in the dozing state.
DOZE_WAKE_LOCK = 64;
// Keep the device awake enough to allow drawing to occur. This is used
// by the window manager to allow applications to draw while the system
// is dozing. It currently has no effect unless the power manager is in
// the dozing state.
DRAW_WAKE_LOCK = 128;
}
}
message PowerManagerInternalProto {
// Enum values gotten from PowerManagerInternal.java
enum Wakefulness {
// The device is asleep. It can only be awoken by a call to wakeUp().
// The screen should be off or in the process of being turned off by the
// display controller. The device typically passes through the dozing
// state first.
WAKEFULNESS_ASLEEP = 0;
// The device is fully awake. It can be put to sleep by a call to
// goToSleep(). When the user activity timeout expires, the device may
// start dreaming or go to sleep.
WAKEFULNESS_AWAKE = 1;
// The device is dreaming. It can be awoken by a call to wakeUp(), which
// ends the dream. The device goes to sleep when goToSleep() is called,
// when the dream ends, or when unplugged. User activity may brighten
// the screen but does not end the dream.
WAKEFULNESS_DREAMING = 2;
// The device is dozing. It is almost asleep but is allowing a special
// low-power "doze" dream to run which keeps the display on but lets the
// application processor suspend. It can be awoken by a call to wakeUp()
// which ends the dream. The device fully goes to sleep if the dream
// cannot be started or ends on its own.
WAKEFULNESS_DOZING = 3;
}
}

View File

@@ -599,6 +599,14 @@ message SettingProto {
optional bool default_from_system = 6;
}
message SettingsProto {
// Enum values gotten from Settings.java
enum ScreenBrightnessMode {
SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
}
}
message SettingsOperationProto {
// When the operation happened
optional int64 timestamp = 1;

View File

@@ -15,16 +15,21 @@
*/
syntax = "proto2";
package android.service.power;
package com.android.server.power;
option java_multiple_files = true;
option java_outer_classname = "PowerServiceProto";
import "frameworks/base/core/proto/android/app/activitymanager.proto";
import "frameworks/base/core/proto/android/content/intent.proto";
import "frameworks/base/core/proto/android/os/batterymanager.proto";
import "frameworks/base/core/proto/android/os/looper.proto";
import "frameworks/base/core/proto/android/os/powermanager.proto";
import "frameworks/base/core/proto/android/os/worksource.proto";
import "frameworks/base/core/proto/android/service/wirelesschargerdetector.proto";
import "frameworks/base/core/proto/android/providers/settings.proto";
import "frameworks/base/core/proto/android/server/wirelesschargerdetector.proto";
import "frameworks/base/core/proto/android/view/display.proto";
message PowerServiceDumpProto {
message PowerManagerServiceDumpProto {
message ConstantsProto {
optional bool is_no_cached_wake_locks = 1;
}
@@ -45,78 +50,12 @@ message PowerServiceDumpProto {
optional bool is_screen_dream = 3;
}
message UidProto {
// Enum values gotten from ActivityManager.java
enum ProcessState {
// Process is a persistent system process.
PROCESS_STATE_PERSISTENT = 0;
// Process is a persistent system process and is doing UI.
PROCESS_STATE_PERSISTENT_UI = 1;
// Process is hosting the current top activities. Note that this
// covers all activities that are visible to the user.
PROCESS_STATE_TOP = 2;
// Process is hosting a foreground service due to a system binding.
PROCESS_STATE_BOUND_FOREGROUND_SERVICE = 3;
// Process is hosting a foreground service.
PROCESS_STATE_FOREGROUND_SERVICE = 4;
// Same as {@link #PROCESS_STATE_TOP} but while device is sleeping.
PROCESS_STATE_TOP_SLEEPING = 5;
// Process is important to the user, and something they are aware of.
PROCESS_STATE_IMPORTANT_FOREGROUND = 6;
// Process is important to the user, but not something they are aware of.
PROCESS_STATE_IMPORTANT_BACKGROUND = 7;
// Process is in the background running a backup/restore operation.
PROCESS_STATE_BACKUP = 8;
// Process is in the background, but it can't restore its state so
// we want to try to avoid killing it.
PROCESS_STATE_HEAVY_WEIGHT = 9;
// Process is in the background running a service.
PROCESS_STATE_SERVICE = 10;
// Process is in the background running a receiver.
PROCESS_STATE_RECEIVER = 11;
// Process is in the background but hosts the home activity.
PROCESS_STATE_HOME = 12;
// Process is in the background but hosts the last shown activity.
PROCESS_STATE_LAST_ACTIVITY = 13;
// Process is being cached for later use and contains activities.
PROCESS_STATE_CACHED_ACTIVITY = 14;
// Process is being cached for later use and is a client of another
// cached process that contains activities.
PROCESS_STATE_CACHED_ACTIVITY_CLIENT = 15;
// Process is being cached for later use and is empty.
PROCESS_STATE_CACHED_EMPTY = 16;
// Process does not exist.
PROCESS_STATE_NONEXISTENT = 17;
}
optional int32 uid = 1;
optional string uid_string = 2;
optional bool is_active = 3;
optional int32 num_wake_locks = 4;
optional bool is_process_state_unknown = 5;
optional ProcessState process_state = 6;
}
// Enum values gotten from PowerManagerInternal.java
enum Wakefulness {
WAKEFULNESS_ASLEEP = 0;
WAKEFULNESS_AWAKE = 1;
WAKEFULNESS_DREAMING = 2;
WAKEFULNESS_DOZING = 3;
WAKEFULNESS_UNKNOWN = 4;
}
// Enum values gotten from BatteryManager.java
enum PlugType {
PLUG_TYPE_NONE = 0;
PLUG_TYPE_PLUGGED_AC = 1;
PLUG_TYPE_PLUGGED_USB = 2;
PLUG_TYPE_PLUGGED_WIRELESS = 4;
}
// Enum values gotten from Intent.java
enum DockState {
DOCK_STATE_UNDOCKED = 0;
DOCK_STATE_DESK = 1;
DOCK_STATE_CAR = 2;
DOCK_STATE_LE_DESK = 3;
DOCK_STATE_HE_DESK = 4;
optional .android.app.ActivityManagerProto.ProcessState process_state = 6;
}
optional ConstantsProto constants = 1;
@@ -124,18 +63,18 @@ message PowerServiceDumpProto {
// changed and need to be recalculated.
optional int32 dirty = 2;
// Indicates whether the device is awake or asleep or somewhere in between.
optional Wakefulness wakefulness = 3;
optional .android.os.PowerManagerInternalProto.Wakefulness wakefulness = 3;
optional bool is_wakefulness_changing = 4;
// True if the device is plugged into a power source.
optional bool is_powered = 5;
// The current plug type
optional PlugType plug_type = 6;
optional .android.os.BatteryManagerProto.PlugType plug_type = 6;
// The current battery level percentage.
optional int32 battery_level = 7;
// The battery level percentage at the time the dream started.
optional int32 battery_level_when_dream_started = 8;
// The current dock state.
optional DockState dock_state = 9;
optional .android.content.IntentProto.DockState dock_state = 9;
// True if the device should stay on.
optional bool is_stay_on = 10;
// True if the proximity sensor reads a positive result.
@@ -216,7 +155,7 @@ message PowerServiceDumpProto {
optional bool are_uids_changed = 45;
// List of UIDs and their states
repeated UidProto uids = 46;
optional android.os.LooperProto looper = 47;
optional .android.os.LooperProto looper = 47;
// List of all wake locks acquired by applications.
repeated WakeLockProto wake_locks = 48;
// List of all suspend blockers.
@@ -238,27 +177,7 @@ message WakeLockProto {
optional bool is_on_after_release = 2;
}
// Enum values gotten from PowerManager.java
enum LockLevel {
WAKE_LOCK_INVALID = 0;
// Ensures that the CPU is running.
PARTIAL_WAKE_LOCK = 1;
// Ensures that the screen is on (but may be dimmed).
SCREEN_DIM_WAKE_LOCK = 6;
// Ensures that the screen is on at full brightness.
SCREEN_BRIGHT_WAKE_LOCK = 10;
// Ensures that the screen and keyboard backlight are on at full brightness.
FULL_WAKE_LOCK = 26;
// Turns the screen off when the proximity sensor activates.
PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32;
// Put the screen in a low power state and allow the CPU to suspend
// if no other wake locks are held.
DOZE_WAKE_LOCK = 64;
// Keep the device awake enough to allow drawing to occur.
DRAW_WAKE_LOCK = 128;
}
optional LockLevel lock_level = 1;
optional .android.os.PowerManagerProto.WakeLockLevel lock_level = 1;
optional string tag = 2;
optional WakeLockFlagsProto flags = 3;
optional bool is_disabled = 4;
@@ -269,7 +188,7 @@ message WakeLockProto {
optional int32 uid = 7;
// Owner PID
optional int32 pid = 8;
optional android.os.WorkSourceProto work_source = 9;
optional .android.os.WorkSourceProto work_source = 9;
}
message PowerServiceSettingsAndConfigurationDumpProto {
@@ -285,22 +204,6 @@ message PowerServiceSettingsAndConfigurationDumpProto {
optional int32 setting_for_vr_default = 4;
}
// Enum values gotten from Settings.java
enum ScreenBrightnessMode {
SCREEN_BRIGHTNESS_MODE_MANUAL = 0;
SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1;
}
// Enum values gotten from Display.java
enum DisplayState {
DISPLAY_STATE_UNKNOWN = 0;
DISPLAY_STATE_OFF = 1;
DISPLAY_STATE_ON = 2;
DISPLAY_STATE_DOZE = 3;
DISPLAY_STATE_DOZE_SUSPEND = 4;
DISPLAY_STATE_VR = 5;
}
// True to decouple auto-suspend mode from the display state.
optional bool is_decouple_hal_auto_suspend_mode_from_display_config = 1;
// True to decouple interactive mode from the display state.
@@ -371,7 +274,7 @@ message PowerServiceSettingsAndConfigurationDumpProto {
// Use 0 if there is no adjustment.
optional float screen_auto_brightness_adjustment_setting = 31;
// The screen brightness mode.
optional ScreenBrightnessMode screen_brightness_mode_setting = 32;
optional .android.providers.settings.SettingsProto.ScreenBrightnessMode screen_brightness_mode_setting = 32;
// The screen brightness setting override from the window manager
// to allow the current foreground activity to override the brightness.
// Use -1 to disable.
@@ -393,7 +296,7 @@ message PowerServiceSettingsAndConfigurationDumpProto {
// Use NaN to disable.
optional float temporary_screen_auto_brightness_adjustment_setting_override = 37;
// The screen state to use while dozing.
optional DisplayState doze_screen_state_override_from_dream_manager = 38;
optional .android.view.DisplayProto.DisplayState doze_screen_state_override_from_dream_manager = 38;
// The screen brightness to use while dozing.
optional float dozed_screen_brightness_override_from_dream_manager = 39;
// Screen brightness settings limits.

View File

@@ -15,7 +15,7 @@
*/
syntax = "proto2";
package android.service.power;
package com.android.server.power;
option java_multiple_files = true;
@@ -46,4 +46,4 @@ message WirelessChargerDetectorProto {
optional VectorProto first_sample = 9;
// The value of the last sample that was collected.
optional VectorProto last_sample = 10;
}
}

View File

@@ -20,13 +20,9 @@ package android.service.battery;
option java_multiple_files = true;
option java_outer_classname = "BatteryServiceProto";
import "frameworks/base/core/proto/android/os/batterymanager.proto";
message BatteryServiceDumpProto {
enum BatteryPlugged {
BATTERY_PLUGGED_NONE = 0;
BATTERY_PLUGGED_AC = 1;
BATTERY_PLUGGED_USB = 2;
BATTERY_PLUGGED_WIRELESS = 4;
}
enum BatteryStatus {
BATTERY_STATUS_INVALID = 0;
BATTERY_STATUS_UNKNOWN = 1;
@@ -49,7 +45,7 @@ message BatteryServiceDumpProto {
// If true: UPDATES STOPPED -- use 'reset' to restart
optional bool are_updates_stopped = 1;
// Plugged status of power sources
optional BatteryPlugged plugged = 2;
optional android.os.BatteryManagerProto.PlugType plugged = 2;
// Max current in microamperes
optional int32 max_charging_current = 3;
// Max voltage

View File

@@ -0,0 +1,41 @@
/*
* 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 = "proto2";
package android.view;
option java_multiple_files = true;
message DisplayProto {
enum DisplayState {
// The display state is unknown.
DISPLAY_STATE_UNKNOWN = 0;
// The display state is off.
DISPLAY_STATE_OFF = 1;
// The display state is on.
DISPLAY_STATE_ON = 2;
// The display is dozing in a low power state; it is still on but is
// optimized for showing system-provided content while the device is
// non-interactive.
DISPLAY_STATE_DOZE = 3;
// The display is dozing in a suspended low power state; it is still on
// but is optimized for showing static system-provided content while the
// device is non-interactive.
DISPLAY_STATE_DOZE_SUSPEND = 4;
// The display is on and optimized for VR mode.
DISPLAY_STATE_VR = 5;
}
}

View File

@@ -43,6 +43,7 @@ import android.hardware.health.V2_0.IHealthInfoCallback;
import android.hardware.health.V2_0.IHealth;
import android.hardware.health.V2_0.Result;
import android.os.BatteryManager;
import android.os.BatteryManagerProto;
import android.os.BatteryManagerInternal;
import android.os.BatteryProperty;
import android.os.Binder;
@@ -913,13 +914,13 @@ public final class BatteryService extends SystemService {
synchronized (mLock) {
proto.write(BatteryServiceDumpProto.ARE_UPDATES_STOPPED, mUpdatesStopped);
int batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_NONE;
int batteryPluggedValue = BatteryManagerProto.PLUG_TYPE_NONE;
if (mHealthInfo.legacy.chargerAcOnline) {
batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_AC;
batteryPluggedValue = BatteryManagerProto.PLUG_TYPE_AC;
} else if (mHealthInfo.legacy.chargerUsbOnline) {
batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_USB;
batteryPluggedValue = BatteryManagerProto.PLUG_TYPE_USB;
} else if (mHealthInfo.legacy.chargerWirelessOnline) {
batteryPluggedValue = BatteryServiceDumpProto.BATTERY_PLUGGED_WIRELESS;
batteryPluggedValue = BatteryManagerProto.PLUG_TYPE_WIRELESS;
}
proto.write(BatteryServiceDumpProto.PLUGGED, batteryPluggedValue);
proto.write(BatteryServiceDumpProto.MAX_CHARGING_CURRENT, mHealthInfo.legacy.maxChargingCurrent);

View File

@@ -58,10 +58,6 @@ import android.os.WorkSource;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.service.dreams.DreamManagerInternal;
import android.service.power.PowerServiceDumpProto;
import android.service.power.PowerServiceSettingsAndConfigurationDumpProto;
import android.service.power.SuspendBlockerProto;
import android.service.power.WakeLockProto;
import android.service.vr.IVrManager;
import android.service.vr.IVrStateCallbacks;
import android.util.EventLog;
@@ -620,8 +616,8 @@ public final class PowerManagerService extends SystemService
}
void dumpProto(ProtoOutputStream proto) {
final long constantsToken = proto.start(PowerServiceDumpProto.CONSTANTS);
proto.write(PowerServiceDumpProto.ConstantsProto.IS_NO_CACHED_WAKE_LOCKS,
final long constantsToken = proto.start(PowerManagerServiceDumpProto.CONSTANTS);
proto.write(PowerManagerServiceDumpProto.ConstantsProto.IS_NO_CACHED_WAKE_LOCKS,
NO_CACHED_WAKE_LOCKS);
proto.end(constantsToken);
}
@@ -3396,112 +3392,112 @@ public final class PowerManagerService extends SystemService
synchronized (mLock) {
mConstants.dumpProto(proto);
proto.write(PowerServiceDumpProto.DIRTY, mDirty);
proto.write(PowerServiceDumpProto.WAKEFULNESS, mWakefulness);
proto.write(PowerServiceDumpProto.IS_WAKEFULNESS_CHANGING, mWakefulnessChanging);
proto.write(PowerServiceDumpProto.IS_POWERED, mIsPowered);
proto.write(PowerServiceDumpProto.PLUG_TYPE, mPlugType);
proto.write(PowerServiceDumpProto.BATTERY_LEVEL, mBatteryLevel);
proto.write(PowerManagerServiceDumpProto.DIRTY, mDirty);
proto.write(PowerManagerServiceDumpProto.WAKEFULNESS, mWakefulness);
proto.write(PowerManagerServiceDumpProto.IS_WAKEFULNESS_CHANGING, mWakefulnessChanging);
proto.write(PowerManagerServiceDumpProto.IS_POWERED, mIsPowered);
proto.write(PowerManagerServiceDumpProto.PLUG_TYPE, mPlugType);
proto.write(PowerManagerServiceDumpProto.BATTERY_LEVEL, mBatteryLevel);
proto.write(
PowerServiceDumpProto.BATTERY_LEVEL_WHEN_DREAM_STARTED,
PowerManagerServiceDumpProto.BATTERY_LEVEL_WHEN_DREAM_STARTED,
mBatteryLevelWhenDreamStarted);
proto.write(PowerServiceDumpProto.DOCK_STATE, mDockState);
proto.write(PowerServiceDumpProto.IS_STAY_ON, mStayOn);
proto.write(PowerServiceDumpProto.IS_PROXIMITY_POSITIVE, mProximityPositive);
proto.write(PowerServiceDumpProto.IS_BOOT_COMPLETED, mBootCompleted);
proto.write(PowerServiceDumpProto.IS_SYSTEM_READY, mSystemReady);
proto.write(PowerManagerServiceDumpProto.DOCK_STATE, mDockState);
proto.write(PowerManagerServiceDumpProto.IS_STAY_ON, mStayOn);
proto.write(PowerManagerServiceDumpProto.IS_PROXIMITY_POSITIVE, mProximityPositive);
proto.write(PowerManagerServiceDumpProto.IS_BOOT_COMPLETED, mBootCompleted);
proto.write(PowerManagerServiceDumpProto.IS_SYSTEM_READY, mSystemReady);
proto.write(
PowerServiceDumpProto.IS_HAL_AUTO_SUSPEND_MODE_ENABLED,
PowerManagerServiceDumpProto.IS_HAL_AUTO_SUSPEND_MODE_ENABLED,
mHalAutoSuspendModeEnabled);
proto.write(
PowerServiceDumpProto.IS_HAL_AUTO_INTERACTIVE_MODE_ENABLED,
PowerManagerServiceDumpProto.IS_HAL_AUTO_INTERACTIVE_MODE_ENABLED,
mHalInteractiveModeEnabled);
final long activeWakeLocksToken = proto.start(PowerServiceDumpProto.ACTIVE_WAKE_LOCKS);
final long activeWakeLocksToken = proto.start(PowerManagerServiceDumpProto.ACTIVE_WAKE_LOCKS);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_CPU,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_CPU,
(mWakeLockSummary & WAKE_LOCK_CPU) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_SCREEN_BRIGHT,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_SCREEN_BRIGHT,
(mWakeLockSummary & WAKE_LOCK_SCREEN_BRIGHT) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_SCREEN_DIM,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_SCREEN_DIM,
(mWakeLockSummary & WAKE_LOCK_SCREEN_DIM) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_BUTTON_BRIGHT,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_BUTTON_BRIGHT,
(mWakeLockSummary & WAKE_LOCK_BUTTON_BRIGHT) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_PROXIMITY_SCREEN_OFF,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_PROXIMITY_SCREEN_OFF,
(mWakeLockSummary & WAKE_LOCK_PROXIMITY_SCREEN_OFF) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_STAY_AWAKE,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_STAY_AWAKE,
(mWakeLockSummary & WAKE_LOCK_STAY_AWAKE) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_DOZE,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_DOZE,
(mWakeLockSummary & WAKE_LOCK_DOZE) != 0);
proto.write(
PowerServiceDumpProto.ActiveWakeLocksProto.IS_DRAW,
PowerManagerServiceDumpProto.ActiveWakeLocksProto.IS_DRAW,
(mWakeLockSummary & WAKE_LOCK_DRAW) != 0);
proto.end(activeWakeLocksToken);
proto.write(PowerServiceDumpProto.NOTIFY_LONG_SCHEDULED_MS, mNotifyLongScheduled);
proto.write(PowerServiceDumpProto.NOTIFY_LONG_DISPATCHED_MS, mNotifyLongDispatched);
proto.write(PowerServiceDumpProto.NOTIFY_LONG_NEXT_CHECK_MS, mNotifyLongNextCheck);
proto.write(PowerManagerServiceDumpProto.NOTIFY_LONG_SCHEDULED_MS, mNotifyLongScheduled);
proto.write(PowerManagerServiceDumpProto.NOTIFY_LONG_DISPATCHED_MS, mNotifyLongDispatched);
proto.write(PowerManagerServiceDumpProto.NOTIFY_LONG_NEXT_CHECK_MS, mNotifyLongNextCheck);
final long userActivityToken = proto.start(PowerServiceDumpProto.USER_ACTIVITY);
final long userActivityToken = proto.start(PowerManagerServiceDumpProto.USER_ACTIVITY);
proto.write(
PowerServiceDumpProto.UserActivityProto.IS_SCREEN_BRIGHT,
PowerManagerServiceDumpProto.UserActivityProto.IS_SCREEN_BRIGHT,
(mUserActivitySummary & USER_ACTIVITY_SCREEN_BRIGHT) != 0);
proto.write(
PowerServiceDumpProto.UserActivityProto.IS_SCREEN_DIM,
PowerManagerServiceDumpProto.UserActivityProto.IS_SCREEN_DIM,
(mUserActivitySummary & USER_ACTIVITY_SCREEN_DIM) != 0);
proto.write(
PowerServiceDumpProto.UserActivityProto.IS_SCREEN_DREAM,
PowerManagerServiceDumpProto.UserActivityProto.IS_SCREEN_DREAM,
(mUserActivitySummary & USER_ACTIVITY_SCREEN_DREAM) != 0);
proto.end(userActivityToken);
proto.write(
PowerServiceDumpProto.IS_REQUEST_WAIT_FOR_NEGATIVE_PROXIMITY,
PowerManagerServiceDumpProto.IS_REQUEST_WAIT_FOR_NEGATIVE_PROXIMITY,
mRequestWaitForNegativeProximity);
proto.write(PowerServiceDumpProto.IS_SANDMAN_SCHEDULED, mSandmanScheduled);
proto.write(PowerServiceDumpProto.IS_SANDMAN_SUMMONED, mSandmanSummoned);
proto.write(PowerServiceDumpProto.IS_LOW_POWER_MODE_ENABLED, mLowPowerModeEnabled);
proto.write(PowerServiceDumpProto.IS_BATTERY_LEVEL_LOW, mBatteryLevelLow);
proto.write(PowerServiceDumpProto.IS_LIGHT_DEVICE_IDLE_MODE, mLightDeviceIdleMode);
proto.write(PowerServiceDumpProto.IS_DEVICE_IDLE_MODE, mDeviceIdleMode);
proto.write(PowerManagerServiceDumpProto.IS_SANDMAN_SCHEDULED, mSandmanScheduled);
proto.write(PowerManagerServiceDumpProto.IS_SANDMAN_SUMMONED, mSandmanSummoned);
proto.write(PowerManagerServiceDumpProto.IS_LOW_POWER_MODE_ENABLED, mLowPowerModeEnabled);
proto.write(PowerManagerServiceDumpProto.IS_BATTERY_LEVEL_LOW, mBatteryLevelLow);
proto.write(PowerManagerServiceDumpProto.IS_LIGHT_DEVICE_IDLE_MODE, mLightDeviceIdleMode);
proto.write(PowerManagerServiceDumpProto.IS_DEVICE_IDLE_MODE, mDeviceIdleMode);
for (int id : mDeviceIdleWhitelist) {
proto.write(PowerServiceDumpProto.DEVICE_IDLE_WHITELIST, id);
proto.write(PowerManagerServiceDumpProto.DEVICE_IDLE_WHITELIST, id);
}
for (int id : mDeviceIdleTempWhitelist) {
proto.write(PowerServiceDumpProto.DEVICE_IDLE_TEMP_WHITELIST, id);
proto.write(PowerManagerServiceDumpProto.DEVICE_IDLE_TEMP_WHITELIST, id);
}
proto.write(PowerServiceDumpProto.LAST_WAKE_TIME_MS, mLastWakeTime);
proto.write(PowerServiceDumpProto.LAST_SLEEP_TIME_MS, mLastSleepTime);
proto.write(PowerServiceDumpProto.LAST_USER_ACTIVITY_TIME_MS, mLastUserActivityTime);
proto.write(PowerManagerServiceDumpProto.LAST_WAKE_TIME_MS, mLastWakeTime);
proto.write(PowerManagerServiceDumpProto.LAST_SLEEP_TIME_MS, mLastSleepTime);
proto.write(PowerManagerServiceDumpProto.LAST_USER_ACTIVITY_TIME_MS, mLastUserActivityTime);
proto.write(
PowerServiceDumpProto.LAST_USER_ACTIVITY_TIME_NO_CHANGE_LIGHTS_MS,
PowerManagerServiceDumpProto.LAST_USER_ACTIVITY_TIME_NO_CHANGE_LIGHTS_MS,
mLastUserActivityTimeNoChangeLights);
proto.write(
PowerServiceDumpProto.LAST_INTERACTIVE_POWER_HINT_TIME_MS,
PowerManagerServiceDumpProto.LAST_INTERACTIVE_POWER_HINT_TIME_MS,
mLastInteractivePowerHintTime);
proto.write(
PowerServiceDumpProto.LAST_SCREEN_BRIGHTNESS_BOOST_TIME_MS,
PowerManagerServiceDumpProto.LAST_SCREEN_BRIGHTNESS_BOOST_TIME_MS,
mLastScreenBrightnessBoostTime);
proto.write(
PowerServiceDumpProto.IS_SCREEN_BRIGHTNESS_BOOST_IN_PROGRESS,
PowerManagerServiceDumpProto.IS_SCREEN_BRIGHTNESS_BOOST_IN_PROGRESS,
mScreenBrightnessBoostInProgress);
proto.write(PowerServiceDumpProto.IS_DISPLAY_READY, mDisplayReady);
proto.write(PowerManagerServiceDumpProto.IS_DISPLAY_READY, mDisplayReady);
proto.write(
PowerServiceDumpProto.IS_HOLDING_WAKE_LOCK_SUSPEND_BLOCKER,
PowerManagerServiceDumpProto.IS_HOLDING_WAKE_LOCK_SUSPEND_BLOCKER,
mHoldingWakeLockSuspendBlocker);
proto.write(
PowerServiceDumpProto.IS_HOLDING_DISPLAY_SUSPEND_BLOCKER,
PowerManagerServiceDumpProto.IS_HOLDING_DISPLAY_SUSPEND_BLOCKER,
mHoldingDisplaySuspendBlocker);
final long settingsAndConfigurationToken =
proto.start(PowerServiceDumpProto.SETTINGS_AND_CONFIGURATION);
proto.start(PowerManagerServiceDumpProto.SETTINGS_AND_CONFIGURATION);
proto.write(
PowerServiceSettingsAndConfigurationDumpProto
.IS_DECOUPLE_HAL_AUTO_SUSPEND_MODE_FROM_DISPLAY_CONFIG,
@@ -3698,42 +3694,43 @@ public final class PowerManagerService extends SystemService
final int sleepTimeout = getSleepTimeoutLocked();
final int screenOffTimeout = getScreenOffTimeoutLocked(sleepTimeout);
final int screenDimDuration = getScreenDimDurationLocked(screenOffTimeout);
proto.write(PowerServiceDumpProto.SLEEP_TIMEOUT_MS, sleepTimeout);
proto.write(PowerServiceDumpProto.SCREEN_OFF_TIMEOUT_MS, screenOffTimeout);
proto.write(PowerServiceDumpProto.SCREEN_DIM_DURATION_MS, screenDimDuration);
proto.write(PowerServiceDumpProto.ARE_UIDS_CHANGING, mUidsChanging);
proto.write(PowerServiceDumpProto.ARE_UIDS_CHANGED, mUidsChanged);
proto.write(PowerManagerServiceDumpProto.SLEEP_TIMEOUT_MS, sleepTimeout);
proto.write(PowerManagerServiceDumpProto.SCREEN_OFF_TIMEOUT_MS, screenOffTimeout);
proto.write(PowerManagerServiceDumpProto.SCREEN_DIM_DURATION_MS, screenDimDuration);
proto.write(PowerManagerServiceDumpProto.ARE_UIDS_CHANGING, mUidsChanging);
proto.write(PowerManagerServiceDumpProto.ARE_UIDS_CHANGED, mUidsChanged);
for (int i = 0; i < mUidState.size(); i++) {
final UidState state = mUidState.valueAt(i);
final long uIDToken = proto.start(PowerServiceDumpProto.UIDS);
final long uIDToken = proto.start(PowerManagerServiceDumpProto.UIDS);
final int uid = mUidState.keyAt(i);
proto.write(PowerServiceDumpProto.UidProto.UID, uid);
proto.write(PowerServiceDumpProto.UidProto.UID_STRING, UserHandle.formatUid(uid));
proto.write(PowerServiceDumpProto.UidProto.IS_ACTIVE, state.mActive);
proto.write(PowerServiceDumpProto.UidProto.NUM_WAKE_LOCKS, state.mNumWakeLocks);
proto.write(PowerManagerServiceDumpProto.UidProto.UID, uid);
proto.write(PowerManagerServiceDumpProto.UidProto.UID_STRING, UserHandle.formatUid(uid));
proto.write(PowerManagerServiceDumpProto.UidProto.IS_ACTIVE, state.mActive);
proto.write(PowerManagerServiceDumpProto.UidProto.NUM_WAKE_LOCKS, state.mNumWakeLocks);
if (state.mProcState == ActivityManager.PROCESS_STATE_UNKNOWN) {
proto.write(PowerServiceDumpProto.UidProto.IS_PROCESS_STATE_UNKNOWN, true);
proto.write(PowerManagerServiceDumpProto.UidProto.IS_PROCESS_STATE_UNKNOWN, true);
} else {
proto.write(PowerServiceDumpProto.UidProto.PROCESS_STATE, state.mProcState);
proto.write(PowerManagerServiceDumpProto.UidProto.PROCESS_STATE,
ActivityManager.processStateAmToProto(state.mProcState));
}
proto.end(uIDToken);
}
mHandler.getLooper().writeToProto(proto, PowerServiceDumpProto.LOOPER);
mHandler.getLooper().writeToProto(proto, PowerManagerServiceDumpProto.LOOPER);
for (WakeLock wl : mWakeLocks) {
wl.writeToProto(proto, PowerServiceDumpProto.WAKE_LOCKS);
wl.writeToProto(proto, PowerManagerServiceDumpProto.WAKE_LOCKS);
}
for (SuspendBlocker sb : mSuspendBlockers) {
sb.writeToProto(proto, PowerServiceDumpProto.SUSPEND_BLOCKERS);
sb.writeToProto(proto, PowerManagerServiceDumpProto.SUSPEND_BLOCKERS);
}
wcd = mWirelessChargerDetector;
}
if (wcd != null) {
wcd.writeToProto(proto, PowerServiceDumpProto.WIRELESS_CHARGER_DETECTOR);
wcd.writeToProto(proto, PowerManagerServiceDumpProto.WIRELESS_CHARGER_DETECTOR);
}
proto.flush();
}

View File

@@ -24,7 +24,6 @@ import android.os.BatteryManager;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.service.power.WirelessChargerDetectorProto;
import android.util.Slog;
import android.util.TimeUtils;
import android.util.proto.ProtoOutputStream;