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

Commit 7da01ae5 authored by Anushree Ganjam's avatar Anushree Ganjam
Browse files

Add the IntFlags too in bugreport in dump() method.

Bug: 309033453
Test: Manual
Flag: None, adding more print to appear in bug report
Change-Id: I6fa3ac98820b3ab0c7ef93a6eb4564efae6191d5
parent e389a856
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ public class FlagsFactory {
    public static final String NAMESPACE_LAUNCHER = "launcher";

    private static final List<DebugFlag> sDebugFlags = new ArrayList<>();
    private static final List<IntFlag> sIntFlags = new ArrayList<>();
    private static SharedPreferences sSharedPreferences;

    static final BooleanFlag TEAMFOOD_FLAG = getReleaseFlag(
@@ -132,7 +133,14 @@ public class FlagsFactory {
    public static IntFlag getIntFlag(
            int bugId, String key, int defaultValueInCode, String description) {
        INSTANCE.mKeySet.add(key);
        return new IntFlag(DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode));
        int defaultValue = DeviceConfig.getInt(NAMESPACE_LAUNCHER, key, defaultValueInCode);
        if (IS_DEBUG_DEVICE) {
            IntDeviceFlag flag = new IntDeviceFlag(key, defaultValue, defaultValueInCode);
            sIntFlags.add(flag);
            return flag;
        } else {
            return new IntFlag(defaultValue);
        }
    }

    static List<DebugFlag> getDebugFlags() {
@@ -178,6 +186,12 @@ public class FlagsFactory {
                }
            }
        }
        pw.println("IntFlags:");
        synchronized (sIntFlags) {
            for (IntFlag flag : sIntFlags) {
                pw.println("  " + flag);
            }
        }
    }

    private void onPropertiesChanged(Properties properties) {
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.launcher3.uioverrides.flags;

import com.android.launcher3.config.FeatureFlags.IntFlag;

public class IntDeviceFlag extends IntFlag {
    public final String key;
    private final int mDefaultValueInCode;

    public IntDeviceFlag(String key, int currentValue, int defaultValueInCode) {
        super(currentValue);
        this.key = key;
        mDefaultValueInCode = defaultValueInCode;
    }

    @Override
    public String toString() {
        return key + ": mCurrentValue=" + get() + ", defaultValueInCode=" + mDefaultValueInCode;
    }
}