Design doc: go/android-tznotifications Test: atest and on device Bug: 283267917 Bug: 283437447 Flag: com.android.server.flags.datetime_notifications Change-Id: I91ea363a145d7184c997beae17862387114bc09b
53 lines
2.1 KiB
Java
53 lines
2.1 KiB
Java
/*
|
|
* Copyright (C) 2024 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.settings.datetime;
|
|
|
|
import static android.provider.DeviceConfig.NAMESPACE_SETTINGS_UI;
|
|
|
|
import android.provider.DeviceConfig;
|
|
|
|
import com.android.settings.flags.Flags;
|
|
|
|
/** A class to avoid duplication of launch-control logic for "time feedback" support. */
|
|
final class DateTimeLaunchUtils {
|
|
/**
|
|
* A {@link DeviceConfig} flag that influences whether the settings entries related to help and
|
|
* feedback are supported on this device / for this user.
|
|
*/
|
|
public static final String KEY_HELP_AND_FEEDBACK_FEATURE_SUPPORTED =
|
|
"time_help_and_feedback_feature_supported";
|
|
|
|
private DateTimeLaunchUtils() {}
|
|
|
|
static boolean isFeedbackFeatureSupported() {
|
|
// Support is determined according to:
|
|
// 1) A build-time flag to determine release feature availability.
|
|
// 2) A runtime / server-side flag to determine which devices / who gets to see the feature.
|
|
// This is launch control for limiting the feedback to droidfooding.
|
|
return isFeedbackFeatureSupportedThisRelease() && isFeedbackFeatureSupportedOnThisDevice();
|
|
}
|
|
|
|
private static boolean isFeedbackFeatureSupportedThisRelease() {
|
|
return Flags.datetimeFeedback();
|
|
}
|
|
|
|
private static boolean isFeedbackFeatureSupportedOnThisDevice() {
|
|
boolean defaultIsSupported = false;
|
|
return DeviceConfig.getBoolean(
|
|
NAMESPACE_SETTINGS_UI, KEY_HELP_AND_FEEDBACK_FEATURE_SUPPORTED, defaultIsSupported);
|
|
}
|
|
}
|