Add support to hide developer tile based on a flag

Define new meta-data option for development tiles that can be used to
specify a sysprop flag.
If this meta-data is present, the value will be used as the flag name
that has to be enabled for the preference to show up.

Bug: 248363970
Test: atest SettingsRoboTests:DevelopmentTilePreferenceControllerTest
Change-Id: I66d56777a6290d7fee739492bd2871f637791d75
This commit is contained in:
Ats Jenk
2022-09-22 16:44:51 -07:00
parent 108b73d972
commit 618876c6c9
4 changed files with 84 additions and 6 deletions

View File

@@ -58,6 +58,22 @@ import com.android.settingslib.development.DevelopmentSettingsEnabler;
import com.android.settingslib.development.SystemPropPoker;
public abstract class DevelopmentTiles extends TileService {
/**
* Meta-data for a development tile to declare a sysprop flag that needs to be enabled for
* the tile to be available.
*
* To define the flag, set this meta-data on the tile's manifest declaration.
* <pre class="prettyprint">
* {@literal
* <meta-data android:name="com.android.settings.development.qstile.REQUIRES_SYSTEM_PROPERTY"
* android:value="persist.debug.flag_name_here" />
* }
* </pre>
*/
public static final String META_DATA_REQUIRES_SYSTEM_PROPERTY =
"com.android.settings.development.qstile.REQUIRES_SYSTEM_PROPERTY";
private static final String TAG = "DevelopmentTiles";
protected abstract boolean isEnabled();