Define private manifest flag for home sound exception and add permission

Test: manual
Test: atest HomeSoundEffectControllerTest
Bug: 167946828
Bug: 157407957
Change-Id: If8278013a7b558e837f3e831fabe8ca3a737aa6e
This commit is contained in:
Philip Junker
2021-02-25 18:41:08 +01:00
parent 624a0f2d0e
commit 0b6eaf12b1
6 changed files with 32 additions and 2 deletions

View File

@@ -92,6 +92,7 @@ package android {
field public static final String CREATE_USERS = "android.permission.CREATE_USERS"; field public static final String CREATE_USERS = "android.permission.CREATE_USERS";
field public static final String CRYPT_KEEPER = "android.permission.CRYPT_KEEPER"; field public static final String CRYPT_KEEPER = "android.permission.CRYPT_KEEPER";
field public static final String DEVICE_POWER = "android.permission.DEVICE_POWER"; field public static final String DEVICE_POWER = "android.permission.DEVICE_POWER";
field public static final String DISABLE_SYSTEM_SOUND_EFFECTS = "android.permission.DISABLE_SYSTEM_SOUND_EFFECTS";
field public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE"; field public static final String DISPATCH_PROVISIONING_MESSAGE = "android.permission.DISPATCH_PROVISIONING_MESSAGE";
field public static final String DOMAIN_VERIFICATION_AGENT = "android.permission.DOMAIN_VERIFICATION_AGENT"; field public static final String DOMAIN_VERIFICATION_AGENT = "android.permission.DOMAIN_VERIFICATION_AGENT";
field public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission.ENTER_CAR_MODE_PRIORITIZED"; field public static final String ENTER_CAR_MODE_PRIORITIZED = "android.permission.ENTER_CAR_MODE_PRIORITIZED";
@@ -311,6 +312,7 @@ package android {
field public static final int hotwordDetectionService = 16844326; // 0x1010626 field public static final int hotwordDetectionService = 16844326; // 0x1010626
field public static final int isVrOnly = 16844152; // 0x1010578 field public static final int isVrOnly = 16844152; // 0x1010578
field public static final int minExtensionVersion = 16844305; // 0x1010611 field public static final int minExtensionVersion = 16844305; // 0x1010611
field public static final int playHomeTransitionSound = 16844358; // 0x1010646
field public static final int requiredSystemPropertyName = 16844133; // 0x1010565 field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566 field public static final int requiredSystemPropertyValue = 16844134; // 0x1010566
field public static final int sdkVersion = 16844304; // 0x1010610 field public static final int sdkVersion = 16844304; // 0x1010610

View File

@@ -549,10 +549,19 @@ public class ActivityInfo extends ComponentInfo implements Parcelable {
*/ */
public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1; public static final int FLAG_INHERIT_SHOW_WHEN_LOCKED = 0x1;
/**
* Bit in {@link #privateFlags} indicating whether a home sound effect should be played if the
* home app moves to front after the activity with this flag set.
* Set from the {@link android.R.attr#playHomeTransitionSound} attribute.
* @hide
*/
public static final int PRIVATE_FLAG_HOME_TRANSITION_SOUND = 0x2;
/** /**
* Options that have been set in the activity declaration in the manifest. * Options that have been set in the activity declaration in the manifest.
* These include: * These include:
* {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED}. * {@link #FLAG_INHERIT_SHOW_WHEN_LOCKED},
* {@link #PRIVATE_FLAG_HOME_TRANSITION_SOUND}.
* @hide * @hide
*/ */
public int privateFlags; public int privateFlags;

View File

@@ -149,7 +149,10 @@ public class ParsedActivityUtils {
| flag(ActivityInfo.FLAG_TURN_SCREEN_ON, R.styleable.AndroidManifestActivity_turnScreenOn, sa) | flag(ActivityInfo.FLAG_TURN_SCREEN_ON, R.styleable.AndroidManifestActivity_turnScreenOn, sa)
| flag(ActivityInfo.FLAG_PREFER_MINIMAL_POST_PROCESSING, R.styleable.AndroidManifestActivity_preferMinimalPostProcessing, sa); | flag(ActivityInfo.FLAG_PREFER_MINIMAL_POST_PROCESSING, R.styleable.AndroidManifestActivity_preferMinimalPostProcessing, sa);
activity.privateFlags |= flag(ActivityInfo.FLAG_INHERIT_SHOW_WHEN_LOCKED, R.styleable.AndroidManifestActivity_inheritShowWhenLocked, sa); activity.privateFlags |= flag(ActivityInfo.FLAG_INHERIT_SHOW_WHEN_LOCKED,
R.styleable.AndroidManifestActivity_inheritShowWhenLocked, sa)
| flag(ActivityInfo.PRIVATE_FLAG_HOME_TRANSITION_SOUND,
R.styleable.AndroidManifestActivity_playHomeTransitionSound, true, sa);
activity.colorMode = sa.getInt(R.styleable.AndroidManifestActivity_colorMode, ActivityInfo.COLOR_MODE_DEFAULT); activity.colorMode = sa.getInt(R.styleable.AndroidManifestActivity_colorMode, ActivityInfo.COLOR_MODE_DEFAULT);
activity.documentLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_documentLaunchMode, ActivityInfo.DOCUMENT_LAUNCH_NONE); activity.documentLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_documentLaunchMode, ActivityInfo.DOCUMENT_LAUNCH_NONE);

View File

@@ -4440,6 +4440,13 @@
<permission android:name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS" <permission android:name="android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS"
android:protectionLevel="signature|privileged" /> android:protectionLevel="signature|privileged" />
<!-- @SystemApi Allows an application to disable system sound effects when the user exits one of
the application's activities.
<p>Not for use by third-party applications.</p>
@hide -->
<permission android:name="android.permission.DISABLE_SYSTEM_SOUND_EFFECTS"
android:protectionLevel="signature|privileged" />
<!-- @SystemApi Allows an application to provide remote displays. <!-- @SystemApi Allows an application to provide remote displays.
<p>Not for use by third-party applications.</p> <p>Not for use by third-party applications.</p>
@hide --> @hide -->

View File

@@ -2862,6 +2862,13 @@
{@link android.content.Context#sendBroadcast(Intent, String)} being used. {@link android.content.Context#sendBroadcast(Intent, String)} being used.
Multiple tags can be specified separated by '|'. --> Multiple tags can be specified separated by '|'. -->
<attr name="attributionTags"/> <attr name="attributionTags"/>
<!-- Specifies whether a home sound effect should be played if the home app moves to
front after an activity with this flag set to <code>true</code>.
<p>The default value of this attribute is <code>true</code>.
<p>Also note that home sounds are only played if the device supports home sounds,
usually TVs.
<p>Requires permission {@code android.permission.DISABLE_SYSTEM_SOUND_EFFECTS}. -->
<attr name="playHomeTransitionSound" format="boolean"/>
</declare-styleable> </declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new <!-- The <code>activity-alias</code> tag declares a new

View File

@@ -3093,6 +3093,8 @@
<public name="suppressesSpellChecker" /> <public name="suppressesSpellChecker" />
<public name="usesPermissionFlags" /> <public name="usesPermissionFlags" />
<public name="requestOptimizedExternalStorageAccess" /> <public name="requestOptimizedExternalStorageAccess" />
<!-- @hide @SystemApi -->
<public name="playHomeTransitionSound" />
</public-group> </public-group>
<public-group type="drawable" first-id="0x010800b5"> <public-group type="drawable" first-id="0x010800b5">