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

Commit e3abce68 authored by Jason Hsu's avatar Jason Hsu Committed by Automerger Merge Worker
Browse files

Merge "Fix the incorrect result of AccessibilityShortcutStats" into sc-v2-dev...

Merge "Fix the incorrect result of AccessibilityShortcutStats" into sc-v2-dev am: f1ecb267 am: c70b0dcb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16388281

Change-Id: If015f808092364353a40623ef30b4bd87e8e7d74
parents f223fd71 c70b0dcb
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -51,6 +51,10 @@ import static android.telephony.TelephonyManager.UNKNOWN_CARRIER_ID;
import static android.util.MathUtils.constrain;

import static com.android.internal.util.ConcurrentUtils.DIRECT_EXECUTOR;
import static com.android.internal.util.FrameworkStatsLog.ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_BUTTON;
import static com.android.internal.util.FrameworkStatsLog.ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_FLOATING_MENU;
import static com.android.internal.util.FrameworkStatsLog.ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_GESTURE;
import static com.android.internal.util.FrameworkStatsLog.ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__UNKNOWN_TYPE;
import static com.android.internal.util.FrameworkStatsLog.DATA_USAGE_BYTES_TRANSFER__OPPORTUNISTIC_DATA_SUB__NOT_OPPORTUNISTIC;
import static com.android.internal.util.FrameworkStatsLog.DATA_USAGE_BYTES_TRANSFER__OPPORTUNISTIC_DATA_SUB__OPPORTUNISTIC;
import static com.android.internal.util.FrameworkStatsLog.TIME_ZONE_DETECTOR_STATE__DETECTION_MODE__GEO;
@@ -4449,8 +4453,9 @@ public class StatsPullAtomService extends SystemService {
                final int userId = userInfo.getUserHandle().getIdentifier();

                if (isAccessibilityShortcutUser(mContext, userId)) {
                    final int software_shortcut_type = Settings.Secure.getIntForUser(resolver,
                            Settings.Secure.ACCESSIBILITY_BUTTON_MODE, 0, userId);
                    final int software_shortcut_type = convertToAccessibilityShortcutType(
                            Settings.Secure.getIntForUser(resolver,
                                    Settings.Secure.ACCESSIBILITY_BUTTON_MODE, 0, userId));
                    final String software_shortcut_list = Settings.Secure.getStringForUser(resolver,
                            Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, userId);
                    final int software_shortcut_service_num = countAccessibilityServices(
@@ -4727,6 +4732,19 @@ public class StatsPullAtomService extends SystemService {
                && !TextUtils.isEmpty(software_string);
    }

    private int convertToAccessibilityShortcutType(int shortcutType) {
        switch (shortcutType) {
            case Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR:
                return ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_BUTTON;
            case Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATING_MENU:
                return ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_FLOATING_MENU;
            case Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE:
                return ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__A11Y_GESTURE;
            default:
                return ACCESSIBILITY_SHORTCUT_REPORTED__SHORTCUT_TYPE__UNKNOWN_TYPE;
        }
    }

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