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

Commit 03e2e684 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge changes from topic "am-d1c7d9928f02482c974cfb2c7b85d42b" into main

* changes:
  Merge changes from topic "b279054964-flag-api-udc-qpr-dev" into udc-qpr-dev am: 44f28146 am: dc1c7737
  Add permissions to FeatureFlagService and override api. am: c25fd5ae am: f1537f53
  Add Local FeatureFlags client to system servier. am: 7c3cae6b am: ffa8030c
  Connect FeatureFlags with FeatureFlagsService. am: f593888d am: a658fb22
  Define FeatureFlagsService. am: 4f7ccd42 am: 572c31e8
  A new Client-Side FeatureFlags library. am: 27f4ca52 am: 9b1fc243
parents 604256a2 61aeeac3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -38,6 +38,15 @@ filegroup {
    srcs: ["com/android/internal/os/IBinaryTransparencyService.aidl"],
}

filegroup {
    name: "feature_flags_aidl",
    srcs: [
        "android/flags/IFeatureFlags.aidl",
        "android/flags/IFeatureFlagsCallback.aidl",
        "android/flags/SyncableFlag.aidl",
    ],
}

filegroup {
    name: "ITracingServiceProxy.aidl",
    srcs: ["android/tracing/ITracingServiceProxy.aidl"],
+7 −0
Original line number Diff line number Diff line
@@ -5297,6 +5297,13 @@ public abstract class Context {
    @SystemApi
    public static final String APP_PREDICTION_SERVICE = "app_prediction";

    /**
     * Used for reading system-wide, overridable flags.
     *
     * @hide
     */
    public static final String FEATURE_FLAGS_SERVICE = "feature_flags";

    /**
     * Official published name of the search ui service.
     *
+52 −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 android.flags;

import android.annotation.NonNull;

/**
 * A flag representing a true or false value.
 *
 * The value will always be the same during the lifetime of the process it is read in.
 *
 * @hide
 */
public class BooleanFlag extends BooleanFlagBase {
    private final boolean mDefault;

    /**
     * @param namespace A namespace for this flag. See {@link android.provider.DeviceConfig}.
     * @param name A name for this flag.
     * @param defaultValue The value of this flag if no other override is present.
     */
    BooleanFlag(String namespace, String name, boolean defaultValue) {
        super(namespace, name);
        mDefault = defaultValue;
    }

    @Override
    @NonNull
    public Boolean getDefault() {
        return mDefault;
    }

    @Override
    public BooleanFlag defineMetaData(String label, String description, String categoryName) {
        super.defineMetaData(label, description, categoryName);
        return this;
    }
}
+82 −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 android.flags;

import android.annotation.NonNull;

abstract class BooleanFlagBase implements Flag<Boolean> {

    private final String mNamespace;
    private final String mName;
    private String mLabel;
    private String mDescription;
    private String mCategoryName;

    /**
     * @param namespace A namespace for this flag. See {@link android.provider.DeviceConfig}.
     * @param name A name for this flag.
     */
    BooleanFlagBase(String namespace, String name) {
        mNamespace = namespace;
        mName = name;
        mLabel = name;
    }

    public abstract Boolean getDefault();

    @Override
    @NonNull
    public String getNamespace() {
        return mNamespace;
    }

    @Override
    @NonNull
    public String getName() {
        return mName;
    }

    @Override
    public BooleanFlagBase defineMetaData(String label, String description, String categoryName) {
        mLabel = label;
        mDescription = description;
        mCategoryName = categoryName;
        return this;
    }

    @Override
    @NonNull
    public String getLabel() {
        return mLabel;
    }

    @Override
    public String getDescription() {
        return mDescription;
    }

    @Override
    public String getCategoryName() {
        return mCategoryName;
    }

    @Override
    @NonNull
    public String toString() {
        return getNamespace() + "." + getName() + "[" + getDefault() + "]";
    }
}
+50 −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 android.flags;

/**
 * A flag representing a true or false value.
 *
 * The value may be different from one read to the next.
 *
 * @hide
 */
public class DynamicBooleanFlag extends BooleanFlagBase implements DynamicFlag<Boolean> {

    private final boolean mDefault;

    /**
     * @param namespace A namespace for this flag. See {@link android.provider.DeviceConfig}.
     * @param name A name for this flag.
     * @param defaultValue The value of this flag if no other override is present.
     */
    DynamicBooleanFlag(String namespace, String name, boolean defaultValue) {
        super(namespace, name);
        mDefault = defaultValue;
    }

    @Override
    public Boolean getDefault() {
        return mDefault;
    }

    @Override
    public DynamicBooleanFlag defineMetaData(String label, String description, String categoryName) {
        super.defineMetaData(label, description, categoryName);
        return this;
    }
}
Loading