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

Commit 3ab2065d authored by Muhammad Qureshi's avatar Muhammad Qureshi Committed by Android (Google) Code Review
Browse files

Merge "Add sysui module for logging SystemUI atoms."

parents 7901f7f1 9bced7d7
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ message Atom {
        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
        ExcessiveCpuUsageReported excessive_cpu_usage_reported = 16;
        CachedKillReported cached_kill_reported = 17;
        CachedKillReported cached_kill_reported = 17;
        ProcessMemoryStatReported process_memory_stat_reported = 18;
        ProcessMemoryStatReported process_memory_stat_reported = 18;
        LauncherUIChanged launcher_event = 19;
        LauncherUIChanged launcher_event = 19 [(module) = "sysui"];
        BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
        BatterySaverModeStateChanged battery_saver_mode_state_changed = 20;
        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
        DeviceIdleModeStateChanged device_idle_mode_state_changed = 21;
        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
        DeviceIdlingModeStateChanged device_idling_mode_state_changed = 22;
@@ -138,9 +138,9 @@ message Atom {
        OverlayStateChanged overlay_state_changed = 59;
        OverlayStateChanged overlay_state_changed = 59;
        ForegroundServiceStateChanged foreground_service_state_changed = 60;
        ForegroundServiceStateChanged foreground_service_state_changed = 60;
        CallStateChanged call_state_changed = 61;
        CallStateChanged call_state_changed = 61;
        KeyguardStateChanged keyguard_state_changed = 62;
        KeyguardStateChanged keyguard_state_changed = 62 [(module) = "sysui"];
        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63;
        KeyguardBouncerStateChanged keyguard_bouncer_state_changed = 63 [(module) = "sysui"];
        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64;
        KeyguardBouncerPasswordEntered keyguard_bouncer_password_entered = 64 [(module) = "sysui"];
        AppDied app_died = 65;
        AppDied app_died = 65;
        ResourceConfigurationChanged resource_configuration_changed = 66;
        ResourceConfigurationChanged resource_configuration_changed = 66;
        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
        BluetoothEnabledStateChanged bluetooth_enabled_state_changed = 67;
@@ -231,7 +231,7 @@ message Atom {
        UsbContaminantReported usb_contaminant_reported = 146;
        UsbContaminantReported usb_contaminant_reported = 146;
        WatchdogRollbackOccurred watchdog_rollback_occurred = 147;
        WatchdogRollbackOccurred watchdog_rollback_occurred = 147;
        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected = 148;
        BiometricSystemHealthIssueDetected biometric_system_health_issue_detected = 148;
        BubbleUIChanged bubble_ui_changed = 149;
        BubbleUIChanged bubble_ui_changed = 149 [(module) = "sysui"];
        ScheduledJobConstraintChanged scheduled_job_constraint_changed = 150;
        ScheduledJobConstraintChanged scheduled_job_constraint_changed = 150;
        BluetoothActiveDeviceChanged bluetooth_active_device_changed = 151;
        BluetoothActiveDeviceChanged bluetooth_active_device_changed = 151;
        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed = 152;
        BluetoothA2dpPlaybackStateChanged bluetooth_a2dp_playback_state_changed = 152;
@@ -262,7 +262,7 @@ message Atom {
        AssistGestureProgressReported assist_gesture_progress_reported = 176;
        AssistGestureProgressReported assist_gesture_progress_reported = 176;
        TouchGestureClassified touch_gesture_classified = 177;
        TouchGestureClassified touch_gesture_classified = 177;
        HiddenApiUsed hidden_api_used = 178 [(allow_from_any_uid) = true];
        HiddenApiUsed hidden_api_used = 178 [(allow_from_any_uid) = true];
        StyleUIChanged style_ui_changed = 179 [(module) = "style"];
        StyleUIChanged style_ui_changed = 179 [(module) = "sysui"];
        PrivacyIndicatorsInteracted privacy_indicators_interacted =
        PrivacyIndicatorsInteracted privacy_indicators_interacted =
            180 [(module) = "permissioncontroller"];
            180 [(module) = "permissioncontroller"];
        AppInstallOnExternalStorageReported app_install_on_external_storage_reported = 181;
        AppInstallOnExternalStorageReported app_install_on_external_storage_reported = 181;
@@ -317,7 +317,7 @@ message Atom {
        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
        ConversationActionsEvent conversation_actions_event = 221  [(module) = "textclassifier"];
        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
        LanguageDetectionEvent language_detection_event = 222  [(module) = "textclassifier"];
        ExclusionRectStateChanged exclusion_rect_state_changed = 223;
        ExclusionRectStateChanged exclusion_rect_state_changed = 223;
        BackGesture back_gesture_reported_reported = 224;
        BackGesture back_gesture_reported_reported = 224 [(module) = "sysui"];
        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
        UpdateEngineUpdateAttemptReported update_engine_update_attempt_reported = 225;
        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
        UpdateEngineSuccessfulUpdateReported update_engine_successful_update_reported = 226;
        CameraActionEvent camera_action_event = 227;
        CameraActionEvent camera_action_event = 227;
+17 −2
Original line number Original line Diff line number Diff line
@@ -12,8 +12,22 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.


android_library {
genrule {
    name: "statslog-SystemUI-java-gen",
    tools: ["stats-log-api-gen"],
    cmd: "$(location stats-log-api-gen) --java $(out) --module sysui --javaPackage com.android.systemui.shared.system --javaClass SysUiStatsLog",
    out: ["com/android/systemui/shared/system/SysUiStatsLog.java"],
}

java_library {
    name: "SystemUI-statsd",

    srcs: [
        ":statslog-SystemUI-java-gen",
    ],
}


android_library {
    name: "SystemUISharedLib",
    name: "SystemUISharedLib",
    srcs: [
    srcs: [
        "src/**/*.java",
        "src/**/*.java",
@@ -21,7 +35,8 @@ android_library {
    ],
    ],


    static_libs: [
    static_libs: [
        "PluginCoreLib"
        "PluginCoreLib",
        "SystemUI-statsd",
    ],
    ],


    // Enforce that the library is built against java 7 so that there are
    // Enforce that the library is built against java 7 so that there are
+0 −51
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2018 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.
 */

package com.android.systemui.shared.system;

import android.util.StatsLog;

/**
 * Wrapper class to make StatsLog hidden API accessible.
 */
public class StatsLogCompat {

    /**
     * StatsLog.write(StatsLog.LAUNCHER_EVENT, int action, int src_state, int dst_state,
     *                byte[] extension, boolean is_swipe_up_enabled);
     */
    public static void write(int action, int srcState, int dstState, byte [] extension,
            boolean swipeUpEnabled) {
        StatsLog.write(19, action, srcState, dstState, extension,
                swipeUpEnabled);
    }

    /**
     *  StatsLog.write(StatsLog.STYLE_EVENT, action, colorPackageHash,
     *           fontPackageHash, shapePackageHash, clockPackageHash,
     *           launcherGrid, wallpaperCategoryHash, wallpaperIdHash,
     *           colorPreference, locationPreference);
     */
    public static void write(int action, int colorPackageHash,
            int fontPackageHash, int shapePackageHash, int clockPackageHash,
            int launcherGrid, int wallpaperCategoryHash, int wallpaperIdHash,
            int colorPreference, int locationPreference) {
        StatsLog.write(179, action, colorPackageHash,
                fontPackageHash, shapePackageHash, clockPackageHash,
                launcherGrid, wallpaperCategoryHash, wallpaperIdHash,
                colorPreference, locationPreference);
    }
}
+5 −5
Original line number Original line Diff line number Diff line
@@ -28,7 +28,6 @@ import android.os.UserHandle;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.util.Slog;
import android.util.Slog;
import android.util.StatsLog;
import android.util.TypedValue;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.MotionEvent;
@@ -50,6 +49,7 @@ import com.android.settingslib.utils.ThreadUtils;
import com.android.systemui.Dependency;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.InjectionInflationController;
import com.android.systemui.util.InjectionInflationController;


@@ -615,8 +615,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe


        public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
        public void reportUnlockAttempt(int userId, boolean success, int timeoutMs) {
            if (success) {
            if (success) {
                StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
                SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
                    StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__SUCCESS);
                        SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__SUCCESS);
                mLockPatternUtils.reportSuccessfulPasswordAttempt(userId);
                mLockPatternUtils.reportSuccessfulPasswordAttempt(userId);
                // Force a garbage collection in an attempt to erase any lockscreen password left in
                // Force a garbage collection in an attempt to erase any lockscreen password left in
                // memory. Do it asynchronously with a 5-sec delay to avoid making the keyguard
                // memory. Do it asynchronously with a 5-sec delay to avoid making the keyguard
@@ -628,8 +628,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
                    Runtime.getRuntime().gc();
                    Runtime.getRuntime().gc();
                });
                });
            } else {
            } else {
                StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
                SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED,
                    StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__FAILURE);
                        SysUiStatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__FAILURE);
                KeyguardSecurityContainer.this.reportFailedUnlockAttempt(userId, timeoutMs);
                KeyguardSecurityContainer.this.reportFailedUnlockAttempt(userId, timeoutMs);
            }
            }
            mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
            mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
+3 −3
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@ import android.os.RemoteException;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Log;
import android.util.StatsLog;
import android.view.View;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.view.WindowManager;
@@ -52,6 +51,7 @@ import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.systemui.Dependency;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.R;
import com.android.systemui.recents.TriangleShape;
import com.android.systemui.recents.TriangleShape;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.AlphaOptimizedButton;
import com.android.systemui.statusbar.AlphaOptimizedButton;


/**
/**
@@ -467,7 +467,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
            mStackView.collapseStack(() -> {
            mStackView.collapseStack(() -> {
                mContext.startActivityAsUser(intent, mBubble.getEntry().getSbn().getUser());
                mContext.startActivityAsUser(intent, mBubble.getEntry().getSbn().getUser());
                logBubbleClickEvent(mBubble,
                logBubbleClickEvent(mBubble,
                        StatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
                        SysUiStatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
            });
            });
        }
        }
    }
    }
@@ -564,7 +564,7 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList
     */
     */
    private void logBubbleClickEvent(Bubble bubble, int action) {
    private void logBubbleClickEvent(Bubble bubble, int action) {
        StatusBarNotification notification = bubble.getEntry().getSbn();
        StatusBarNotification notification = bubble.getEntry().getSbn();
        StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
        SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                notification.getPackageName(),
                notification.getPackageName(),
                notification.getNotification().getChannelId(),
                notification.getNotification().getChannelId(),
                notification.getId(),
                notification.getId(),
Loading