From 68b31b017e0861915d7bb98c44b4e90bf6fb1ce2 Mon Sep 17 00:00:00 2001 From: Kevin Han Date: Wed, 6 Jan 2021 15:09:59 -0800 Subject: [PATCH] Add feature flag for app hibernation. Add feature flag for app hibernation so that we can begin implementing behind a feature flag. We use DeviceConfig as per instructions at go/android-flags-setup so that we may eventually roll this out to dogfood devices using P/H and Mendel. This is the downstream merge of http://aosp/1542244 Bug: 175829330 Test: Builds Change-Id: I27b4bdd9b6ed25b06fc685183f0dc872094f1b5c --- core/api/system-current.txt | 1 + core/java/android/provider/DeviceConfig.java | 7 +++++ .../AppHibernationConstants.java | 28 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 services/core/java/com/android/server/apphibernation/AppHibernationConstants.java diff --git a/core/api/system-current.txt b/core/api/system-current.txt index b942635c1b556..27392729e250a 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -8568,6 +8568,7 @@ package android.provider { field public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager"; field public static final String NAMESPACE_ACTIVITY_MANAGER_NATIVE_BOOT = "activity_manager_native_boot"; field public static final String NAMESPACE_APP_COMPAT = "app_compat"; + field public static final String NAMESPACE_APP_HIBERNATION = "app_hibernation"; field public static final String NAMESPACE_ATTENTION_MANAGER_SERVICE = "attention_manager_service"; field public static final String NAMESPACE_AUTOFILL = "autofill"; field public static final String NAMESPACE_BATTERY_SAVER = "battery_saver"; diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java index ec4d81c10b5b1..7a856e8a02b7f 100644 --- a/core/java/android/provider/DeviceConfig.java +++ b/core/java/android/provider/DeviceConfig.java @@ -100,6 +100,13 @@ public final class DeviceConfig { @SystemApi public static final String NAMESPACE_APP_COMPAT = "app_compat"; + /** + * Namespace for all app hibernation related features. + * @hide + */ + @SystemApi + public static final String NAMESPACE_APP_HIBERNATION = "app_hibernation"; + /** * Namespace for app standby configurations. * diff --git a/services/core/java/com/android/server/apphibernation/AppHibernationConstants.java b/services/core/java/com/android/server/apphibernation/AppHibernationConstants.java new file mode 100644 index 0000000000000..9d43a39072bf7 --- /dev/null +++ b/services/core/java/com/android/server/apphibernation/AppHibernationConstants.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2021 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.server.apphibernation; + +/** + * Flags and constants that modify app hibernation behavior. + */ +final class AppHibernationConstants { + + private AppHibernationConstants() {} + + // Device config feature flag for app hibernation + static final String KEY_APP_HIBERNATION_ENABLED = "app_hibernation_enabled"; +}