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

Commit aca0d0b0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "b150519505_disp_up_reason_atom"

* changes:
  Register Display Wake Reason Puller
  Display wake reason atom
parents cbf42a47 e9dcb27f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ message Atom {
    }

    // Pulled events will start at field 10000.
    // Next: 10080
    // Next: 10082
    oneof pulled {
        WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
        WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
@@ -526,6 +526,7 @@ message Atom {
        SimSlotState sim_slot_state = 10078 [(module) = "telephony"];
        SupportedRadioAccessFamily supported_radio_access_family = 10079 [(module) = "telephony"];
        SettingSnapshot setting_snapshot = 10080 [(module) = "framework"];
        DisplayWakeReason display_wake_reason = 10081 [(module) = "framework"];
    }

    // DO NOT USE field numbers above 100,000 in AOSP.
@@ -9508,3 +9509,15 @@ message AccessibilityServiceReported {
    // From frameworks/base/core/proto/android/stats/accessibility/accessibility_enums.proto.
    optional android.stats.accessibility.ServiceStatus service_status = 2;
}


message DisplayWakeReason {
    // Wake_up_reason code
    // If LOWORD(wake_up_reason) = 0
    //     reference to HIWORD(wake_up_reason) PowerManager.WAKE_REASON_XXX
    //     else reference wake_up_reason to
    //     frameworks/base/services/core/java/com/android/server/power/Notifier.java#DispWakeupReason
    optional int32 wake_up_reason = 1;
    // Count of wake up by reason
    optional int32 wake_times = 2;
}
+18 −0
Original line number Diff line number Diff line
@@ -422,6 +422,8 @@ public class StatsPullAtomService extends SystemService {
                        return pullAttributedAppOps(atomTag, data);
                    case FrameworkStatsLog.SETTING_SNAPSHOT:
                        return pullSettingsStats(atomTag, data);
                    case FrameworkStatsLog.DISPLAY_WAKE_REASON:
                        return pullDisplayWakeStats(atomTag, data);
                    default:
                        throw new UnsupportedOperationException("Unknown tagId=" + atomTag);
                }
@@ -587,6 +589,7 @@ public class StatsPullAtomService extends SystemService {
        registerBatteryVoltage();
        registerBatteryCycleCount();
        registerSettingsStats();
        registerDisplayWakeStats();
    }

    /**
@@ -3296,6 +3299,21 @@ public class StatsPullAtomService extends SystemService {
        return StatsManager.PULL_SUCCESS;
    }

    private void registerDisplayWakeStats() {
        int tagId = FrameworkStatsLog.DISPLAY_WAKE_REASON;
        mStatsManager.setPullAtomCallback(
                tagId,
                null, // use default PullAtomMetadata values
                BackgroundThread.getExecutor(),
                mStatsCallbackImpl
        );
    }

    int pullDisplayWakeStats(int atomTag, List<StatsEvent> pulledData) {
        //TODO: Denny, implement read/write DisplayWakeStats, b/154172964
        return 0;
    }

    // Thermal event received from vendor thermal management subsystem
    private static final class ThermalEventListener extends IThermalEventListener.Stub {
        @Override