Merge "Update manifest to account for new startup library"
diff --git a/core/api/current.txt b/core/api/current.txt
index 2f01265..a0a46a2 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -20209,10 +20209,8 @@
method public int getAllowedCapturePolicy();
method public int getContentType();
method public int getFlags();
- method public int getSpatializationBehavior();
method public int getUsage();
method public int getVolumeControlStream();
- method public boolean isContentSpatialized();
method public void writeToParcel(android.os.Parcel, int);
field public static final int ALLOW_CAPTURE_BY_ALL = 1; // 0x1
field public static final int ALLOW_CAPTURE_BY_NONE = 3; // 0x3
@@ -20226,8 +20224,6 @@
field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
field @Deprecated public static final int FLAG_LOW_LATENCY = 256; // 0x100
- field public static final int SPATIALIZATION_BEHAVIOR_AUTO = 0; // 0x0
- field public static final int SPATIALIZATION_BEHAVIOR_NEVER = 1; // 0x1
field public static final int USAGE_ALARM = 4; // 0x4
field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
@@ -20254,9 +20250,7 @@
method public android.media.AudioAttributes.Builder setContentType(int);
method public android.media.AudioAttributes.Builder setFlags(int);
method @NonNull public android.media.AudioAttributes.Builder setHapticChannelsMuted(boolean);
- method @NonNull public android.media.AudioAttributes.Builder setIsContentSpatialized(boolean);
method public android.media.AudioAttributes.Builder setLegacyStreamType(int);
- method @NonNull public android.media.AudioAttributes.Builder setSpatializationBehavior(int);
method public android.media.AudioAttributes.Builder setUsage(int);
}
@@ -20481,7 +20475,6 @@
method public String getProperty(String);
method public int getRingerMode();
method @Deprecated public int getRouting(int);
- method @Nullable public android.media.Spatializer getSpatializer();
method public int getStreamMaxVolume(int);
method public int getStreamMinVolume(int);
method public int getStreamVolume(int);
@@ -23894,17 +23887,6 @@
method public void onLoadComplete(android.media.SoundPool, int, int);
}
- public class Spatializer {
- method public void addOnSpatializerEnabledChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.Spatializer.OnSpatializerEnabledChangedListener);
- method public boolean canBeSpatialized(@NonNull android.media.AudioAttributes, @NonNull android.media.AudioFormat);
- method public boolean isEnabled();
- method public void removeOnSpatializerEnabledChangedListener(@NonNull android.media.Spatializer.OnSpatializerEnabledChangedListener);
- }
-
- public static interface Spatializer.OnSpatializerEnabledChangedListener {
- method public void onSpatializerEnabledChanged(boolean);
- }
-
public final class SubtitleData {
ctor public SubtitleData(int, long, long, @NonNull byte[]);
method @NonNull public byte[] getData();
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 6727031..54a591b 100755
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -5412,12 +5412,6 @@
field public static final android.media.RouteDiscoveryPreference EMPTY;
}
- public class Spatializer {
- method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void addCompatibleAudioDevice(@NonNull android.media.AudioDeviceAttributes);
- method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public java.util.List<android.media.AudioDeviceAttributes> getCompatibleAudioDevices();
- method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING) public void removeCompatibleAudioDevice(@NonNull android.media.AudioDeviceAttributes);
- }
-
}
package android.media.audiofx {
@@ -6197,7 +6191,7 @@
method public void close();
method public int configure(@NonNull android.media.tv.tuner.filter.FilterConfiguration);
method public int flush();
- method public int getId();
+ method @Deprecated public int getId();
method public long getIdLong();
method public int read(@NonNull byte[], long, long);
method public int setDataSource(@Nullable android.media.tv.tuner.filter.Filter);
@@ -6556,7 +6550,8 @@
public static class AnalogFrontendSettings.Builder {
method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setAftFlag(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setSifStandard(int);
method @NonNull public android.media.tv.tuner.frontend.AnalogFrontendSettings.Builder setSignalType(int);
}
@@ -6624,7 +6619,8 @@
method @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setBandwidth(int);
method @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setDemodOutputFormat(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.Atsc3FrontendSettings.Builder setPlpSettings(@NonNull android.media.tv.tuner.frontend.Atsc3PlpSettings[]);
}
@@ -6667,7 +6663,8 @@
public static class AtscFrontendSettings.Builder {
method @NonNull public android.media.tv.tuner.frontend.AtscFrontendSettings build();
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AtscFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AtscFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.AtscFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.AtscFrontendSettings.Builder setModulation(int);
}
@@ -6727,7 +6724,8 @@
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setBandwidth(int);
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setCodeRate(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setGuardInterval(int);
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setModulation(int);
method @NonNull public android.media.tv.tuner.frontend.DtmbFrontendSettings.Builder setTimeInterleaveMode(int);
@@ -6791,7 +6789,8 @@
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setAnnex(int);
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setBandwidth(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setInnerFec(long);
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setModulation(int);
method @NonNull public android.media.tv.tuner.frontend.DvbcFrontendSettings.Builder setOuterFec(int);
@@ -6879,7 +6878,8 @@
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setCanHandleDiseqcRxMessage(boolean);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setCodeRate(@Nullable android.media.tv.tuner.frontend.DvbsCodeRate);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setInputStreamId(int);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setModulation(int);
method @NonNull public android.media.tv.tuner.frontend.DvbsFrontendSettings.Builder setPilot(int);
@@ -6988,7 +6988,8 @@
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setBandwidth(int);
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setConstellation(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setGuardInterval(int);
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setHierarchy(int);
method @NonNull public android.media.tv.tuner.frontend.DvbtFrontendSettings.Builder setHighPriority(boolean);
@@ -7007,9 +7008,11 @@
}
public class FrontendInfo {
- method public int getAcquireRange();
+ method @Deprecated public int getAcquireRange();
+ method public long getAcquireRangeLong();
method public int getExclusiveGroupId();
- method @NonNull public android.util.Range<java.lang.Integer> getFrequencyRange();
+ method @Deprecated @NonNull public android.util.Range<java.lang.Integer> getFrequencyRange();
+ method @NonNull public android.util.Range<java.lang.Long> getFrequencyRangeLong();
method @NonNull public android.media.tv.tuner.frontend.FrontendCapabilities getFrontendCapabilities();
method public int getId();
method @NonNull public int[] getStatusCapabilities();
@@ -7018,11 +7021,14 @@
}
public abstract class FrontendSettings {
- method @IntRange(from=1) public int getEndFrequency();
- method public int getFrequency();
+ method @Deprecated @IntRange(from=1) public int getEndFrequency();
+ method @IntRange(from=1) public long getEndFrequencyLong();
+ method @Deprecated public int getFrequency();
+ method public long getFrequencyLong();
method public int getFrontendSpectralInversion();
method public abstract int getType();
- method @IntRange(from=1) public void setEndFrequency(int);
+ method @Deprecated @IntRange(from=1) public void setEndFrequency(int);
+ method @IntRange(from=1) public void setEndFrequencyLong(long);
method public void setSpectralInversion(int);
field public static final long FEC_11_15 = 4194304L; // 0x400000L
field public static final long FEC_11_20 = 8388608L; // 0x800000L
@@ -7085,7 +7091,8 @@
method @NonNull public int[] getBers();
method @NonNull public int[] getCodeRates();
method @NonNull public int[] getExtendedModulations();
- method public int getFreqOffset();
+ method @Deprecated public int getFreqOffset();
+ method public long getFreqOffsetLong();
method public int getGuardInterval();
method public int getHierarchy();
method public long getInnerFec();
@@ -7201,7 +7208,8 @@
public static class Isdbs3FrontendSettings.Builder {
method @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setCodeRate(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setModulation(int);
method @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setRolloff(int);
method @NonNull public android.media.tv.tuner.frontend.Isdbs3FrontendSettings.Builder setStreamId(int);
@@ -7244,7 +7252,8 @@
public static class IsdbsFrontendSettings.Builder {
method @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setCodeRate(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setModulation(int);
method @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setRolloff(int);
method @NonNull public android.media.tv.tuner.frontend.IsdbsFrontendSettings.Builder setStreamId(int);
@@ -7291,7 +7300,8 @@
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings build();
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setBandwidth(int);
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setCodeRate(int);
- method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setFrequency(int);
+ method @Deprecated @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setFrequency(int);
+ method @IntRange(from=1) @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setFrequencyLong(long);
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setGuardInterval(int);
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setMode(int);
method @NonNull public android.media.tv.tuner.frontend.IsdbtFrontendSettings.Builder setModulation(int);
@@ -7311,7 +7321,8 @@
method public default void onDvbcAnnexReported(int);
method public void onDvbsStandardReported(int);
method public void onDvbtStandardReported(int);
- method public void onFrequenciesReported(@NonNull int[]);
+ method public default void onFrequenciesLongReported(@NonNull long[]);
+ method @Deprecated public void onFrequenciesReported(@NonNull int[]);
method public void onGroupIdsReported(@NonNull int[]);
method public void onHierarchyReported(int);
method public void onInputStreamIdsReported(@NonNull int[]);
diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING
index 23fc6f3..31c81be 100644
--- a/core/java/android/app/TEST_MAPPING
+++ b/core/java/android/app/TEST_MAPPING
@@ -115,21 +115,6 @@
"file_patterns": ["(/|^)VoiceInteract[^/]*"]
},
{
- "name": "CtsContentTestCases",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.content.wm.cts"
- }
- ],
- "file_patterns": ["(/|^)ContextImpl.java"]
- },
- {
"name": "CtsOsTestCases",
"options": [
{
@@ -163,6 +148,23 @@
"file_patterns": ["(/|^)ContextImpl.java"]
}
],
+ "presubmit-large": [
+ {
+ "name": "CtsContentTestCases",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ },
+ {
+ "exclude-annotation": "org.junit.Ignore"
+ },
+ {
+ "include-filter": "android.content.wm.cts"
+ }
+ ],
+ "file_patterns": ["(/|^)ContextImpl.java"]
+ }
+ ],
"postsubmit": [
{
"file_patterns": ["(/|^)ActivityThreadClientTest.java"],
diff --git a/core/java/android/content/LocusId.java b/core/java/android/content/LocusId.java
index a04fbd1..b6cdd96 100644
--- a/core/java/android/content/LocusId.java
+++ b/core/java/android/content/LocusId.java
@@ -62,6 +62,9 @@
* <li>Configuring your app to launch the chat conversation through the
* {@link Intent#ACTION_VIEW_LOCUS} intent.
* </ul>
+ *
+ * NOTE: The LocusId is only used by an on-device intelligence service provided by the Android
+ * System, see {@link ContentCaptureManager} for more details.
*/
public final class LocusId implements Parcelable {
diff --git a/core/java/android/content/TEST_MAPPING b/core/java/android/content/TEST_MAPPING
index 614143e..7f1d0d1 100644
--- a/core/java/android/content/TEST_MAPPING
+++ b/core/java/android/content/TEST_MAPPING
@@ -1,21 +1,6 @@
{
"presubmit": [
{
- "name": "CtsContentTestCases",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.content.wm.cts"
- }
- ],
- "file_patterns": ["(/|^)Context.java", "(/|^)ContextWrapper.java"]
- },
- {
"name": "CtsOsTestCases",
"options": [
{
@@ -51,5 +36,22 @@
],
"file_patterns": ["(/|^)Context.java", "(/|^)ContextWrapper.java", "(/|^)ComponentCallbacksController.java"]
}
+ ],
+ "presubmit-large": [
+ {
+ "name": "CtsContentTestCases",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ },
+ {
+ "exclude-annotation": "org.junit.Ignore"
+ },
+ {
+ "include-filter": "android.content.wm.cts"
+ }
+ ],
+ "file_patterns": ["(/|^)Context.java", "(/|^)ContextWrapper.java"]
+ }
]
}
\ No newline at end of file
diff --git a/core/java/android/content/om/TEST_MAPPING b/core/java/android/content/om/TEST_MAPPING
index d8f8854..6185cf6 100644
--- a/core/java/android/content/om/TEST_MAPPING
+++ b/core/java/android/content/om/TEST_MAPPING
@@ -21,7 +21,9 @@
"include-filter": "android.appsecurity.cts.OverlayHostTest"
}
]
- },
+ }
+ ],
+ "presubmit-large": [
{
"name": "CtsContentTestCases",
"options": [
diff --git a/core/java/android/content/pm/TEST_MAPPING b/core/java/android/content/pm/TEST_MAPPING
index 8bc3734..0a69413 100644
--- a/core/java/android/content/pm/TEST_MAPPING
+++ b/core/java/android/content/pm/TEST_MAPPING
@@ -19,6 +19,16 @@
"name": "CarrierAppIntegrationTestCases"
},
{
+ "name": "CtsIncrementalInstallHostTestCases",
+ "options": [
+ {
+ "include-filter": "android.incrementalinstall.cts.IncrementalFeatureTest"
+ }
+ ]
+ }
+ ],
+ "presubmit-large": [
+ {
"name": "CtsContentTestCases",
"options": [
{
@@ -31,14 +41,6 @@
"include-filter": "android.content.pm.cts"
}
]
- },
- {
- "name": "CtsIncrementalInstallHostTestCases",
- "options": [
- {
- "include-filter": "android.incrementalinstall.cts.IncrementalFeatureTest"
- }
- ]
}
],
"postsubmit": [
diff --git a/core/java/android/content/res/TEST_MAPPING b/core/java/android/content/res/TEST_MAPPING
index c02af59..535afd36 100644
--- a/core/java/android/content/res/TEST_MAPPING
+++ b/core/java/android/content/res/TEST_MAPPING
@@ -2,7 +2,9 @@
"presubmit": [
{
"name": "CtsResourcesLoaderTests"
- },
+ }
+ ],
+ "presubmit-large": [
{
"name": "CtsContentTestCases",
"options": [
diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java
index b55a1cb..eab9d8b 100644
--- a/core/java/android/hardware/camera2/CaptureRequest.java
+++ b/core/java/android/hardware/camera2/CaptureRequest.java
@@ -1022,7 +1022,8 @@
* <p>which define a transform from input sensor colors, <code>P_in = [ r g b ]</code>,
* to output linear sRGB, <code>P_out = [ r' g' b' ]</code>,</p>
* <p>with colors as follows:</p>
- * <pre><code>r' = I0r + I1g + I2b
+ * <pre><code>
+ * r' = I0r + I1g + I2b
* g' = I3r + I4g + I5b
* b' = I6r + I7g + I8b
* </code></pre>
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index dadea67..4255d88 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1731,12 +1731,12 @@
if (config.orientation != Configuration.ORIENTATION_LANDSCAPE) {
return false;
}
- if ((mInputEditorInfo != null
- && (mInputEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0)
+ if (mInputEditorInfo != null
+ && ((mInputEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0
// If app window has portrait orientation, regardless of what display orientation
// is, IME shouldn't use fullscreen-mode.
|| (mInputEditorInfo.internalImeOptions
- & EditorInfo.IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT) != 0) {
+ & EditorInfo.IME_INTERNAL_FLAG_APP_WINDOW_PORTRAIT) != 0)) {
return false;
}
return true;
diff --git a/core/java/android/util/apk/TEST_MAPPING b/core/java/android/util/apk/TEST_MAPPING
index 4598b4f..e182521 100644
--- a/core/java/android/util/apk/TEST_MAPPING
+++ b/core/java/android/util/apk/TEST_MAPPING
@@ -1,6 +1,16 @@
{
"presubmit": [
{
+ "name": "FrameworksCoreTests",
+ "options": [
+ {
+ "include-filter": "android.util.apk.SourceStampVerifierTest"
+ }
+ ]
+ }
+ ],
+ "presubmit-large": [
+ {
"name": "CtsContentTestCases",
"options": [
{
@@ -10,14 +20,6 @@
"include-filter": "android.content.pm.cts.PackageManagerShellCommandTest"
}
]
- },
- {
- "name": "FrameworksCoreTests",
- "options": [
- {
- "include-filter": "android.util.apk.SourceStampVerifierTest"
- }
- ]
}
]
}
diff --git a/core/java/android/view/ViewConfiguration.java b/core/java/android/view/ViewConfiguration.java
index 495edab..9ed42f3 100644
--- a/core/java/android/view/ViewConfiguration.java
+++ b/core/java/android/view/ViewConfiguration.java
@@ -433,9 +433,8 @@
mAmbiguousGestureMultiplier = Math.max(1.0f, multiplierValue.getFloat());
// Size of the screen in bytes, in ARGB_8888 format
- final WindowManager windowManager = context.getSystemService(WindowManager.class);
- final Rect maxWindowBounds = windowManager.getMaximumWindowMetrics().getBounds();
- mMaximumDrawingCacheSize = 4 * maxWindowBounds.width() * maxWindowBounds.height();
+ final Rect maxBounds = config.windowConfiguration.getMaxBounds();
+ mMaximumDrawingCacheSize = 4 * maxBounds.width() * maxBounds.height();
mOverscrollDistance = (int) (sizeAndDensity * OVERSCROLL_DISTANCE + 0.5f);
mOverflingDistance = (int) (sizeAndDensity * OVERFLING_DISTANCE + 0.5f);
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index eb6bc58..98947d2 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -333,6 +333,12 @@
int TRANSIT_OLD_TASK_FRAGMENT_CLOSE = 29;
/**
+ * A window of task fragment is changing bounds.
+ * @hide
+ */
+ int TRANSIT_OLD_TASK_FRAGMENT_CHANGE = 30;
+
+ /**
* @hide
*/
@IntDef(prefix = { "TRANSIT_OLD_" }, value = {
@@ -359,7 +365,8 @@
TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
TRANSIT_OLD_TASK_FRAGMENT_OPEN,
- TRANSIT_OLD_TASK_FRAGMENT_CLOSE
+ TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
+ TRANSIT_OLD_TASK_FRAGMENT_CHANGE
})
@Retention(RetentionPolicy.SOURCE)
@interface TransitionOldType {}
diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java
index a2d3e34..7bd156b 100644
--- a/core/java/android/view/WindowManagerImpl.java
+++ b/core/java/android/view/WindowManagerImpl.java
@@ -16,6 +16,7 @@
package android.view;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
import static android.view.View.SYSTEM_UI_FLAG_VISIBLE;
@@ -300,7 +301,6 @@
}
}
- // TODO(b/150095967): Set window type to LayoutParams
private WindowInsets computeWindowInsets(Rect bounds) {
// Initialize params which used for obtaining all system insets.
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
@@ -322,10 +322,10 @@
.getWindowInsets(attrs, mContext.getDisplayId(), insetsState);
final Configuration config = mContext.getResources().getConfiguration();
final boolean isScreenRound = config.isScreenRound();
- final int windowingMode = config.windowConfiguration.getWindowingMode();
return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState*/,
isScreenRound, alwaysConsumeSystemBars, SOFT_INPUT_ADJUST_NOTHING, attrs.flags,
- SYSTEM_UI_FLAG_VISIBLE, attrs.type, windowingMode, null /* typeSideMap */);
+ SYSTEM_UI_FLAG_VISIBLE, attrs.type, WINDOWING_MODE_FULLSCREEN,
+ null /* typeSideMap */);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/com/android/internal/app/ChooserActivity.java b/core/java/com/android/internal/app/ChooserActivity.java
index 35d25ca..4d0f4c2 100644
--- a/core/java/com/android/internal/app/ChooserActivity.java
+++ b/core/java/com/android/internal/app/ChooserActivity.java
@@ -45,7 +45,6 @@
import android.content.IntentFilter;
import android.content.IntentSender;
import android.content.IntentSender.SendIntentException;
-import android.content.ServiceConnection;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
@@ -71,11 +70,9 @@
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
-import android.os.IBinder;
import android.os.Message;
import android.os.Parcelable;
import android.os.PatternMatcher;
-import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.UserHandle;
import android.os.UserManager;
@@ -86,14 +83,10 @@
import android.provider.OpenableColumns;
import android.provider.Settings;
import android.service.chooser.ChooserTarget;
-import android.service.chooser.ChooserTargetService;
-import android.service.chooser.IChooserTargetResult;
-import android.service.chooser.IChooserTargetService;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.HashedStringCache;
import android.util.Log;
-import android.util.Pair;
import android.util.Size;
import android.util.Slog;
import android.view.LayoutInflater;
@@ -145,10 +138,8 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
/**
* The Chooser Activity handles intent resolution specifically for sharing intents -
@@ -206,7 +197,6 @@
private boolean mIsAppPredictorComponentAvailable;
private Map<ChooserTarget, AppTarget> mDirectShareAppTargetCache;
private Map<ChooserTarget, ShortcutInfo> mDirectShareShortcutInfoCache;
- private Map<ComponentName, ComponentName> mChooserTargetComponentNameCache;
public static final int TARGET_TYPE_DEFAULT = 0;
public static final int TARGET_TYPE_CHOOSER_TARGET = 1;
@@ -227,8 +217,6 @@
// statsd logger wrapper
protected ChooserActivityLogger mChooserActivityLogger;
- private static final boolean USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS = true;
-
@IntDef(flag = false, prefix = { "TARGET_TYPE_" }, value = {
TARGET_TYPE_DEFAULT,
TARGET_TYPE_CHOOSER_TARGET,
@@ -268,7 +256,6 @@
private long mChooserShownTime;
protected boolean mIsSuccessfullySelected;
- private long mQueriedTargetServicesTimeMs;
private long mQueriedSharingShortcutsTimeMs;
private int mChooserRowServiceSpacing;
@@ -278,9 +265,6 @@
private static final String TARGET_DETAILS_FRAGMENT_TAG = "targetDetailsFragment";
- private final List<ChooserTargetServiceConnection> mServiceConnections = new ArrayList<>();
- private final Set<Pair<ComponentName, UserHandle>> mServicesRequested = new HashSet<>();
-
private static final int MAX_LOG_RANK_POSITION = 12;
private static final int MAX_EXTRA_INITIAL_INTENTS = 2;
@@ -457,16 +441,12 @@
private final ChooserHandler mChooserHandler = new ChooserHandler();
private class ChooserHandler extends Handler {
- private static final int CHOOSER_TARGET_SERVICE_RESULT = 1;
private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT = 4;
private static final int SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED = 5;
private static final int LIST_VIEW_UPDATE_MESSAGE = 6;
- private boolean mReceivedDirectShareTargets = false;
-
private void removeAllMessages() {
removeMessages(LIST_VIEW_UPDATE_MESSAGE);
- removeMessages(CHOOSER_TARGET_SERVICE_RESULT);
removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT);
removeMessages(SHORTCUT_MANAGER_SHARE_TARGET_RESULT_COMPLETED);
}
@@ -478,36 +458,6 @@
}
switch (msg.what) {
- case CHOOSER_TARGET_SERVICE_RESULT:
- if (DEBUG) Log.d(TAG, "CHOOSER_TARGET_SERVICE_RESULT");
- final ServiceResultInfo sri = (ServiceResultInfo) msg.obj;
- if (!mServiceConnections.contains(sri.connection)) {
- Log.w(TAG, "ChooserTargetServiceConnection " + sri.connection
- + sri.originalTarget.getResolveInfo().activityInfo.packageName
- + " returned after being removed from active connections."
- + " Have you considered returning results faster?");
- break;
- }
- if (sri.resultTargets != null) {
- ChooserListAdapter adapterForUserHandle =
- mChooserMultiProfilePagerAdapter.getListAdapterForUserHandle(
- sri.userHandle);
- if (adapterForUserHandle != null) {
- adapterForUserHandle.addServiceResults(sri.originalTarget,
- sri.resultTargets, TARGET_TYPE_CHOOSER_TARGET,
- /* directShareShortcutInfoCache */ null);
- if (!sri.resultTargets.isEmpty() && sri.originalTarget != null) {
- mChooserTargetComponentNameCache.put(
- sri.resultTargets.get(0).getComponentName(),
- sri.originalTarget.getResolvedComponentName());
- }
- }
- }
- unbindService(sri.connection);
- sri.connection.destroy();
- mServiceConnections.remove(sri.connection);
- break;
-
case LIST_VIEW_UPDATE_MESSAGE:
if (DEBUG) {
Log.d(TAG, "LIST_VIEW_UPDATE_MESSAGE; ");
@@ -752,7 +702,6 @@
target.getAction()
);
mDirectShareShortcutInfoCache = new HashMap<>();
- mChooserTargetComponentNameCache = new HashMap<>();
setEnterSharedElementCallback(new SharedElementCallback() {
@Override
@@ -1592,7 +1541,6 @@
mRefinementResultReceiver.destroy();
mRefinementResultReceiver = null;
}
- unbindRemainingServices();
mChooserHandler.removeAllMessages();
if (mPreviewCoord != null) mPreviewCoord.cancelLoads();
@@ -1887,96 +1835,6 @@
}
}
- @VisibleForTesting
- protected void queryTargetServices(ChooserListAdapter adapter) {
-
- mQueriedTargetServicesTimeMs = System.currentTimeMillis();
-
- Context selectedProfileContext = createContextAsUser(
- adapter.getUserHandle(), 0 /* flags */);
- final PackageManager pm = selectedProfileContext.getPackageManager();
- ShortcutManager sm = selectedProfileContext.getSystemService(ShortcutManager.class);
- int targetsToQuery = 0;
-
- for (int i = 0, N = adapter.getDisplayResolveInfoCount(); i < N; i++) {
- final DisplayResolveInfo dri = adapter.getDisplayResolveInfo(i);
- if (adapter.getScore(dri) == 0) {
- // A score of 0 means the app hasn't been used in some time;
- // don't query it as it's not likely to be relevant.
- continue;
- }
- final ActivityInfo ai = dri.getResolveInfo().activityInfo;
- if (sm.hasShareTargets(ai.packageName)) {
- // Share targets will be queried from ShortcutManager
- continue;
- }
- final Bundle md = ai.metaData;
- final String serviceName = md != null ? convertServiceName(ai.packageName,
- md.getString(ChooserTargetService.META_DATA_NAME)) : null;
- if (serviceName != null && ChooserFlags.USE_SERVICE_TARGETS_FOR_DIRECT_TARGETS) {
- final ComponentName serviceComponent = new ComponentName(
- ai.packageName, serviceName);
-
- UserHandle userHandle = adapter.getUserHandle();
- Pair<ComponentName, UserHandle> requestedItem =
- new Pair<>(serviceComponent, userHandle);
- if (mServicesRequested.contains(requestedItem)) {
- continue;
- }
- mServicesRequested.add(requestedItem);
-
- final Intent serviceIntent = new Intent(ChooserTargetService.SERVICE_INTERFACE)
- .setComponent(serviceComponent);
-
- if (DEBUG) {
- Log.d(TAG, "queryTargets found target with service " + serviceComponent);
- }
-
- try {
- final String perm = pm.getServiceInfo(serviceComponent, 0).permission;
- if (!ChooserTargetService.BIND_PERMISSION.equals(perm)) {
- Log.w(TAG, "ChooserTargetService " + serviceComponent + " does not require"
- + " permission " + ChooserTargetService.BIND_PERMISSION
- + " - this service will not be queried for ChooserTargets."
- + " add android:permission=\""
- + ChooserTargetService.BIND_PERMISSION + "\""
- + " to the <service> tag for " + serviceComponent
- + " in the manifest.");
- continue;
- }
- } catch (NameNotFoundException e) {
- Log.e(TAG, "Could not look up service " + serviceComponent
- + "; component name not found");
- continue;
- }
-
- final ChooserTargetServiceConnection conn =
- new ChooserTargetServiceConnection(this, dri,
- adapter.getUserHandle());
-
- // Explicitly specify the user handle instead of calling bindService
- // to avoid the warning from calling from the system process without an explicit
- // user handle
- if (bindServiceAsUser(serviceIntent, conn, BIND_AUTO_CREATE | BIND_NOT_FOREGROUND,
- adapter.getUserHandle())) {
- if (DEBUG) {
- Log.d(TAG, "Binding service connection for target " + dri
- + " intent " + serviceIntent);
- }
- mServiceConnections.add(conn);
- targetsToQuery++;
- }
- }
- if (targetsToQuery >= QUERY_TARGET_SERVICE_LIMIT) {
- if (DEBUG) {
- Log.d(TAG, "queryTargets hit query target limit "
- + QUERY_TARGET_SERVICE_LIMIT);
- }
- break;
- }
- }
- }
-
private IntentFilter getTargetIntentFilter() {
try {
final Intent intent = getTargetIntent();
@@ -2107,7 +1965,7 @@
final Message msg = Message.obtain();
msg.what = ChooserHandler.SHORTCUT_MANAGER_SHARE_TARGET_RESULT;
msg.obj = new ServiceResultInfo(chooserListAdapter.getDisplayResolveInfo(i),
- chooserTargets, null, userHandle);
+ chooserTargets, userHandle);
msg.arg1 = shortcutType;
mChooserHandler.sendMessage(msg);
}
@@ -2226,25 +2084,8 @@
return fullName;
}
- void unbindRemainingServices() {
- if (DEBUG) {
- Log.d(TAG, "unbindRemainingServices, " + mServiceConnections.size() + " left");
- }
- for (int i = 0, N = mServiceConnections.size(); i < N; i++) {
- final ChooserTargetServiceConnection conn = mServiceConnections.get(i);
- if (DEBUG) Log.d(TAG, "unbinding " + conn);
- unbindService(conn);
- conn.destroy();
- }
- mServicesRequested.clear();
- mServiceConnections.clear();
- }
-
private void logDirectShareTargetReceived(int logCategory) {
- final long queryTime =
- logCategory == MetricsEvent.ACTION_DIRECT_SHARE_TARGETS_LOADED_SHORTCUT_MANAGER
- ? mQueriedSharingShortcutsTimeMs : mQueriedTargetServicesTimeMs;
- final int apiLatency = (int) (System.currentTimeMillis() - queryTime);
+ final int apiLatency = (int) (System.currentTimeMillis() - mQueriedSharingShortcutsTimeMs);
getMetricsLogger().write(new LogMaker(logCategory).setSubtype(apiLatency));
}
@@ -2290,8 +2131,7 @@
List<AppTargetId> targetIds = new ArrayList<>();
for (ChooserTargetInfo chooserTargetInfo : surfacedTargetInfo) {
ChooserTarget chooserTarget = chooserTargetInfo.getChooserTarget();
- ComponentName componentName = mChooserTargetComponentNameCache.getOrDefault(
- chooserTarget.getComponentName(), chooserTarget.getComponentName());
+ ComponentName componentName = chooserTarget.getComponentName();
if (mDirectShareShortcutInfoCache.containsKey(chooserTarget)) {
String shortcutId = mDirectShareShortcutInfoCache.get(chooserTarget).getId();
targetIds.add(new AppTargetId(
@@ -2782,7 +2622,6 @@
@Override // ResolverListCommunicator
public void onHandlePackagesChanged(ResolverListAdapter listAdapter) {
- mServicesRequested.clear();
mChooserMultiProfilePagerAdapter.getActiveListAdapter().notifyDataSetChanged();
super.onHandlePackagesChanged(listAdapter);
}
@@ -2850,13 +2689,6 @@
queryDirectShareTargets(chooserListAdapter, false);
}
- if (USE_CHOOSER_TARGET_SERVICE_FOR_DIRECT_TARGETS) {
- if (DEBUG) {
- Log.d(TAG, "List built querying services");
- }
-
- queryTargetServices(chooserListAdapter);
- }
getChooserActivityLogger().logSharesheetAppLoadComplete();
}
@@ -3897,116 +3729,15 @@
}
}
- static class ChooserTargetServiceConnection implements ServiceConnection {
- private DisplayResolveInfo mOriginalTarget;
- private ComponentName mConnectedComponent;
- private ChooserActivity mChooserActivity;
- private final UserHandle mUserHandle;
- private final Object mLock = new Object();
-
- private final IChooserTargetResult mChooserTargetResult = new IChooserTargetResult.Stub() {
- @Override
- public void sendResult(List<ChooserTarget> targets) throws RemoteException {
- synchronized (mLock) {
- if (mChooserActivity == null) {
- Log.e(TAG, "destroyed ChooserTargetServiceConnection received result from "
- + mConnectedComponent + "; ignoring...");
- return;
- }
- Context contextAsUser =
- mChooserActivity.createContextAsUser(mUserHandle, 0 /* flags */);
- mChooserActivity.filterServiceTargets(contextAsUser,
- mOriginalTarget.getResolveInfo().activityInfo.packageName, targets);
- final Message msg = Message.obtain();
- msg.what = ChooserHandler.CHOOSER_TARGET_SERVICE_RESULT;
- msg.obj = new ServiceResultInfo(mOriginalTarget, targets,
- ChooserTargetServiceConnection.this, mUserHandle);
- mChooserActivity.mChooserHandler.sendMessage(msg);
- }
- }
- };
-
- public ChooserTargetServiceConnection(ChooserActivity chooserActivity,
- DisplayResolveInfo dri, UserHandle userHandle) {
- mChooserActivity = chooserActivity;
- mOriginalTarget = dri;
- mUserHandle = userHandle;
- }
-
- @Override
- public void onServiceConnected(ComponentName name, IBinder service) {
- if (DEBUG) Log.d(TAG, "onServiceConnected: " + name);
- synchronized (mLock) {
- if (mChooserActivity == null) {
- Log.e(TAG, "destroyed ChooserTargetServiceConnection got onServiceConnected");
- return;
- }
-
- final IChooserTargetService icts = IChooserTargetService.Stub.asInterface(service);
- try {
- icts.getChooserTargets(mOriginalTarget.getResolvedComponentName(),
- mOriginalTarget.getResolveInfo().filter, mChooserTargetResult);
- } catch (RemoteException e) {
- Log.e(TAG, "Querying ChooserTargetService " + name + " failed.", e);
- mChooserActivity.unbindService(this);
- mChooserActivity.mServiceConnections.remove(this);
- destroy();
- }
- }
- }
-
- @Override
- public void onServiceDisconnected(ComponentName name) {
- if (DEBUG) Log.d(TAG, "onServiceDisconnected: " + name);
- synchronized (mLock) {
- if (mChooserActivity == null) {
- Log.e(TAG,
- "destroyed ChooserTargetServiceConnection got onServiceDisconnected");
- return;
- }
-
- mChooserActivity.unbindService(this);
- mChooserActivity.mServiceConnections.remove(this);
- if (mChooserActivity.mServiceConnections.isEmpty()) {
- mChooserActivity.sendVoiceChoicesIfNeeded();
- }
- mConnectedComponent = null;
- destroy();
- }
- }
-
- public void destroy() {
- synchronized (mLock) {
- mChooserActivity = null;
- mOriginalTarget = null;
- }
- }
-
- @Override
- public String toString() {
- return "ChooserTargetServiceConnection{service="
- + mConnectedComponent + ", activity="
- + (mOriginalTarget != null
- ? mOriginalTarget.getResolveInfo().activityInfo.toString()
- : "<connection destroyed>") + "}";
- }
-
- public ComponentName getComponentName() {
- return mOriginalTarget.getResolveInfo().activityInfo.getComponentName();
- }
- }
-
static class ServiceResultInfo {
public final DisplayResolveInfo originalTarget;
public final List<ChooserTarget> resultTargets;
- public final ChooserTargetServiceConnection connection;
public final UserHandle userHandle;
public ServiceResultInfo(DisplayResolveInfo ot, List<ChooserTarget> rt,
- ChooserTargetServiceConnection c, UserHandle userHandle) {
+ UserHandle userHandle) {
originalTarget = ot;
resultTargets = rt;
- connection = c;
this.userHandle = userHandle;
}
}
diff --git a/core/java/com/android/internal/app/ChooserFlags.java b/core/java/com/android/internal/app/ChooserFlags.java
index 1a93f1b..ab6b0f8 100644
--- a/core/java/com/android/internal/app/ChooserFlags.java
+++ b/core/java/com/android/internal/app/ChooserFlags.java
@@ -17,9 +17,6 @@
package com.android.internal.app;
import android.app.prediction.AppPredictionManager;
-import android.provider.DeviceConfig;
-
-import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
/**
* Common flags for {@link ChooserListAdapter} and {@link ChooserActivity}.
@@ -27,15 +24,6 @@
public class ChooserFlags {
/**
- * Whether to use the deprecated {@link android.service.chooser.ChooserTargetService} API for
- * direct share targets. If true, both CTS and Shortcuts will be used to find Direct Share
- * targets. If false, only Shortcuts will be used.
- */
- public static final boolean USE_SERVICE_TARGETS_FOR_DIRECT_TARGETS =
- DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
- SystemUiDeviceConfigFlags.SHARE_USE_SERVICE_TARGETS, false);
-
- /**
* Whether to use {@link AppPredictionManager} to query for direct share targets (as opposed to
* talking directly to {@link android.content.pm.ShortcutManager}.
*/
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 17bb2d2..7fe4b65 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -4887,9 +4887,8 @@
- Option 3 is selected for R.integer.config_letterboxBackgroundType and blur requested
but isn't supported on the device or both dark scrim alpha and blur radius aren't
provided.
- Defaults to black if not specified.
-->
- <color name="config_letterboxBackgroundColor">#000</color>
+ <color name="config_letterboxBackgroundColor">@android:color/system_neutral2_500</color>
<!-- Horizonal position of a center of the letterboxed app window.
0 corresponds to the left side of the screen and 1 to the right side. If given value < 0
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
index b5ab282..cfcbc7d 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserActivityTest.java
@@ -2243,12 +2243,6 @@
(chooserListAdapter.getUserHandle().getIdentifier() == 10);
return null;
};
- boolean[] isQueryTargetServicesCalledOnWorkProfile = new boolean[] { false };
- sOverrides.onQueryTargetServices = chooserListAdapter -> {
- isQueryTargetServicesCalledOnWorkProfile[0] =
- (chooserListAdapter.getUserHandle().getIdentifier() == 10);
- return null;
- };
Intent sendIntent = createSendTextIntent();
sendIntent.setType("TestType");
@@ -2261,8 +2255,6 @@
assertFalse("Direct share targets were queried on a paused work profile",
isQueryDirectShareCalledOnWorkProfile[0]);
- assertFalse("Target services were queried on a paused work profile",
- isQueryTargetServicesCalledOnWorkProfile[0]);
}
@Test
@@ -2282,12 +2274,6 @@
(chooserListAdapter.getUserHandle().getIdentifier() == 10);
return null;
};
- boolean[] isQueryTargetServicesCalledOnWorkProfile = new boolean[] { false };
- sOverrides.onQueryTargetServices = chooserListAdapter -> {
- isQueryTargetServicesCalledOnWorkProfile[0] =
- (chooserListAdapter.getUserHandle().getIdentifier() == 10);
- return null;
- };
Intent sendIntent = createSendTextIntent();
sendIntent.setType("TestType");
@@ -2300,8 +2286,6 @@
assertFalse("Direct share targets were queried on a locked work profile user",
isQueryDirectShareCalledOnWorkProfile[0]);
- assertFalse("Target services were queried on a locked work profile user",
- isQueryTargetServicesCalledOnWorkProfile[0]);
}
@Test
@@ -2346,12 +2330,6 @@
(chooserListAdapter.getUserHandle().getIdentifier() == 10);
return null;
};
- boolean[] isQueryTargetServicesCalledOnWorkProfile = new boolean[] { false };
- sOverrides.onQueryTargetServices = chooserListAdapter -> {
- isQueryTargetServicesCalledOnWorkProfile[0] =
- (chooserListAdapter.getUserHandle().getIdentifier() == 10);
- return null;
- };
Intent sendIntent = createSendTextIntent();
sendIntent.setType("TestType");
@@ -2364,8 +2342,6 @@
assertFalse("Direct share targets were queried on a locked work profile user",
isQueryDirectShareCalledOnWorkProfile[0]);
- assertFalse("Target services were queried on a locked work profile user",
- isQueryTargetServicesCalledOnWorkProfile[0]);
}
@Test
diff --git a/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java b/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
index 9fcab09..6b3d657 100644
--- a/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
+++ b/core/tests/coretests/src/com/android/internal/app/ChooserWrapperActivity.java
@@ -229,14 +229,6 @@
}
@Override
- protected void queryTargetServices(ChooserListAdapter adapter) {
- if (sOverrides.onQueryTargetServices != null) {
- sOverrides.onQueryTargetServices.apply(adapter);
- }
- super.queryTargetServices(adapter);
- }
-
- @Override
protected boolean isQuietModeEnabled(UserHandle userHandle) {
return sOverrides.isQuietModeEnabled;
}
@@ -267,7 +259,6 @@
public Function<PackageManager, PackageManager> createPackageManager;
public Function<TargetInfo, Boolean> onSafelyStartCallback;
public Function<ChooserListAdapter, Void> onQueryDirectShareTargets;
- public Function<ChooserListAdapter, Void> onQueryTargetServices;
public ResolverListController resolverListController;
public ResolverListController workResolverListController;
public Boolean isVoiceInteraction;
@@ -290,7 +281,6 @@
public void reset() {
onSafelyStartCallback = null;
onQueryDirectShareTargets = null;
- onQueryTargetServices = null;
isVoiceInteraction = null;
createPackageManager = null;
previewThumbnail = null;
diff --git a/media/java/android/media/AudioAttributes.java b/media/java/android/media/AudioAttributes.java
index 347a9b1..07444ea 100644
--- a/media/java/android/media/AudioAttributes.java
+++ b/media/java/android/media/AudioAttributes.java
@@ -459,26 +459,13 @@
*/
public static final int FLAG_CAPTURE_PRIVATE = 0x1 << 13;
- /**
- * @hide
- * Flag indicating the audio content has been processed to provide a virtual multichannel
- * audio experience
- */
- public static final int FLAG_CONTENT_SPATIALIZED = 0x1 << 14;
-
- /**
- * @hide
- * Flag indicating the audio content is to never be spatialized
- */
- public static final int FLAG_NEVER_SPATIALIZE = 0x1 << 15;
// Note that even though FLAG_MUTE_HAPTIC is stored as a flag bit, it is not here since
// it is known as a boolean value outside of AudioAttributes.
private static final int FLAG_ALL = FLAG_AUDIBILITY_ENFORCED | FLAG_SECURE | FLAG_SCO
| FLAG_BEACON | FLAG_HW_AV_SYNC | FLAG_HW_HOTWORD | FLAG_BYPASS_INTERRUPTION_POLICY
| FLAG_BYPASS_MUTE | FLAG_LOW_LATENCY | FLAG_DEEP_BUFFER | FLAG_NO_MEDIA_PROJECTION
- | FLAG_NO_SYSTEM_CAPTURE | FLAG_CAPTURE_PRIVATE | FLAG_CONTENT_SPATIALIZED
- | FLAG_NEVER_SPATIALIZE;
+ | FLAG_NO_SYSTEM_CAPTURE | FLAG_CAPTURE_PRIVATE;
private final static int FLAG_ALL_PUBLIC = FLAG_AUDIBILITY_ENFORCED |
FLAG_HW_AV_SYNC | FLAG_LOW_LATENCY;
/* mask of flags that can be set by SDK and System APIs through the Builder */
@@ -640,49 +627,6 @@
}
/**
- * Return true if the audio content associated with these attributes has already been
- * spatialized, that is it has already been processed to offer a binaural or transaural
- * immersive audio experience.
- * @return {@code true} if the content has been processed
- */
- public boolean isContentSpatialized() {
- return (mFlags & FLAG_CONTENT_SPATIALIZED) != 0;
- }
-
- /** @hide */
- @IntDef(flag = false, value = {
- SPATIALIZATION_BEHAVIOR_AUTO,
- SPATIALIZATION_BEHAVIOR_NEVER,
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface SpatializationBehavior {};
-
- /**
- * Constant indicating the audio content associated with these attributes will follow the
- * default platform behavior with regards to which content will be spatialized or not.
- * @see #getSpatializationBehavior()
- * @see Spatializer
- */
- public static final int SPATIALIZATION_BEHAVIOR_AUTO = 0;
-
- /**
- * Constant indicating the audio content associated with these attributes should never
- * be virtualized.
- * @see #getSpatializationBehavior()
- * @see Spatializer
- */
- public static final int SPATIALIZATION_BEHAVIOR_NEVER = 1;
-
- /**
- * Return the behavior affecting whether spatialization will be used.
- * @return the spatialization behavior
- */
- public @SpatializationBehavior int getSpatializationBehavior() {
- return ((mFlags & FLAG_NEVER_SPATIALIZE) != 0)
- ? SPATIALIZATION_BEHAVIOR_NEVER : SPATIALIZATION_BEHAVIOR_AUTO;
- }
-
- /**
* Return the capture policy.
* @return the capture policy set by {@link Builder#setAllowedCapturePolicy(int)} or
* the default if it was not called.
@@ -725,8 +669,6 @@
private int mSource = MediaRecorder.AudioSource.AUDIO_SOURCE_INVALID;
private int mFlags = 0x0;
private boolean mMuteHapticChannels = true;
- private boolean mIsContentSpatialized = false;
- private int mSpatializationBehavior = SPATIALIZATION_BEHAVIOR_AUTO;
private HashSet<String> mTags = new HashSet<String>();
private Bundle mBundle;
private int mPrivacySensitive = PRIVACY_SENSITIVE_DEFAULT;
@@ -757,8 +699,6 @@
mFlags = aa.getAllFlags();
mTags = (HashSet<String>) aa.mTags.clone();
mMuteHapticChannels = aa.areHapticChannelsMuted();
- mIsContentSpatialized = aa.isContentSpatialized();
- mSpatializationBehavior = aa.getSpatializationBehavior();
}
/**
@@ -791,12 +731,6 @@
if (mMuteHapticChannels) {
aa.mFlags |= FLAG_MUTE_HAPTIC;
}
- if (mIsContentSpatialized) {
- aa.mFlags |= FLAG_CONTENT_SPATIALIZED;
- }
- if (mSpatializationBehavior == SPATIALIZATION_BEHAVIOR_NEVER) {
- aa.mFlags |= FLAG_NEVER_SPATIALIZE;
- }
if (mPrivacySensitive == PRIVACY_SENSITIVE_DEFAULT) {
// capturing for camcorder or communication is private by default to
@@ -984,35 +918,6 @@
}
/**
- * Specifies whether the content has already been processed for spatialization.
- * If it has, setting this to true will prevent issues such as double-processing.
- * @param isSpatialized
- * @return the same Builder instance
- */
- public @NonNull Builder setIsContentSpatialized(boolean isSpatialized) {
- mIsContentSpatialized = isSpatialized;
- return this;
- }
-
- /**
- * Sets the behavior affecting whether spatialization will be used.
- * @param sb the spatialization behavior
- * @return the same Builder instance
- *
- */
- public @NonNull Builder setSpatializationBehavior(@SpatializationBehavior int sb) {
- switch (sb) {
- case SPATIALIZATION_BEHAVIOR_NEVER:
- case SPATIALIZATION_BEHAVIOR_AUTO:
- break;
- default:
- throw new IllegalArgumentException("Invalid spatialization behavior " + sb);
- }
- mSpatializationBehavior = sb;
- return this;
- }
-
- /**
* @hide
* Replaces flags.
* @param flags any combination of {@link AudioAttributes#FLAG_ALL}.
@@ -1097,8 +1002,6 @@
mContentType = attributes.mContentType;
mFlags = attributes.getAllFlags();
mMuteHapticChannels = attributes.areHapticChannelsMuted();
- mIsContentSpatialized = attributes.isContentSpatialized();
- mSpatializationBehavior = attributes.getSpatializationBehavior();
mTags = attributes.mTags;
mBundle = attributes.mBundle;
mSource = attributes.mSource;
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index a73b436..1a56915 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -817,7 +817,7 @@
}
@UnsupportedAppUsage
- static IAudioService getService()
+ private static IAudioService getService()
{
if (sService != null) {
return sService;
@@ -2453,149 +2453,6 @@
}
//====================================================================
- // Immersive audio
-
- /**
- * @hide
- * Returns the level of support for immersive audio from the {@link Spatializer} if
- * available.
- * @return the level of immersive audio support through spatialization
- * @see Spatializer#getImmersiveAudioLevel()
- */
- @Spatializer.ImmersiveAudioLevel int getSpatializerImmersiveAudioLevel() {
- final IAudioService service = getService();
- try {
- return service.getSpatializerImmersiveAudioLevel();
- } catch (RemoteException e) {
- return Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
- }
- }
-
- /**
- * Return a handle to the optional platform's {@link Spatializer}
- * @return {@code null} if spatialization is not supported, the {@code Spatializer} instance
- * otherwise.
- */
- public @Nullable Spatializer getSpatializer() {
- if (getSpatializerImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
- return null;
- }
- return new Spatializer(this);
- }
-
- /**
- * @hide
- * @see Spatializer#isEnabled()
- * @return {@code true} if spatialization is enabled
- */
- boolean isSpatializerEnabled() {
- final IAudioService service = getService();
- try {
- return service.isSpatializerEnabled();
- } catch (RemoteException e) {
- Log.e(TAG, "Error querying isSpatializerEnabled, returning false", e);
- return false;
- }
- }
-
- /**
- * @hide
- * @see Spatializer#setEnabled(boolean)
- * Enable/disable the spatialization wherever supported.
- * @param enabled {@code true} to enable
- */
- void setSpatializerFeatureEnabled(boolean enabled) {
- final IAudioService service = getService();
- try {
- service.setSpatializerFeatureEnabled(enabled);
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling setSpatializerFeatureEnabled", e);
- }
- }
-
- /**
- * @hide
- * @see Spatializer#setEnabledForDevice(boolean, AudioDeviceAttributes)
- * @see Spatializer#setEnabled(boolean)
- * @param enabled enable/disable for a specific device.
- * @param device the device concerned with spatializer functionality.
- */
- void setSpatializerEnabledForDevice(boolean enabled,
- @NonNull AudioDeviceAttributes device) {
- final IAudioService service = getService();
- try {
- service.setSpatializerEnabledForDevice(enabled, device);
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling setSpatializerEnabledForDevice", e);
- }
- }
-
- /**
- * @hide
- * @see Spatializer#canBeSpatialized(AudioAttributes, AudioFormat)
- * @param attributes the {@code AudioAttributes} of the content as used for playback
- * @param format the {@code AudioFormat} of the content as used for playback
- * @return true if the device is capable of spatializing the combination of audio
- * format and attributes.
- */
- boolean canBeSpatialized(
- @NonNull AudioAttributes attributes, @NonNull AudioFormat format) {
- final IAudioService service = getService();
- try {
- return service.canBeSpatialized(attributes, format);
- } catch (RemoteException e) {
- Log.e(TAG, "Error querying canBeSpatialized for attr:" + attributes
- + " format:" + format + " returning false", e);
- return false;
- }
- }
-
- /**
- * @hide
- * @see Spatializer#getCompatibleAudioDevices()
- * @return a non-null list of the spatialization-compatible audio devices
- */
- @NonNull List<AudioDeviceAttributes> getSpatializerCompatibleAudioDevices() {
- final IAudioService service = getService();
- try {
- return service.getSpatializerCompatibleAudioDevices();
- } catch (RemoteException e) {
- Log.e(TAG, "Error querying getSpatializerCompatibleAudioDevices(), "
- + " returning empty list", e);
- return new ArrayList<AudioDeviceAttributes>(0);
- }
- }
-
- /**
- * @hide
- * @see Spatializer#addCompatibleAudioDevice(AudioDeviceAttributes)
- * @param ada the audio device compatible with spatialization
- */
- void addSpatializerCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- final IAudioService service = getService();
- try {
- service.addSpatializerCompatibleAudioDevice(ada);
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling addSpatializerCompatibleAudioDevice()", e);
- }
- }
-
- /**
- * @hide
- * @see Spatializer#removeCompatibleAudioDevice(AudioDeviceAttributes)
- * @param ada the audio device incompatible with spatialization
- */
- void removeSpatializerCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- final IAudioService service = getService();
- try {
- service.removeSpatializerCompatibleAudioDevice(ada);
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling removeSpatializerCompatibleAudioDevice()", e);
- }
- }
-
-
- //====================================================================
// Bluetooth SCO control
/**
* Sticky broadcast intent action indicating that the Bluetooth SCO audio
diff --git a/media/java/android/media/IAudioService.aidl b/media/java/android/media/IAudioService.aidl
index 28b4143..b0c4a3b 100755
--- a/media/java/android/media/IAudioService.aidl
+++ b/media/java/android/media/IAudioService.aidl
@@ -20,7 +20,6 @@
import android.content.ComponentName;
import android.media.AudioAttributes;
import android.media.AudioDeviceAttributes;
-import android.media.AudioFormat;
import android.media.AudioFocusInfo;
import android.media.AudioPlaybackConfiguration;
import android.media.AudioRecordingConfiguration;
@@ -35,7 +34,6 @@
import android.media.IRecordingConfigDispatcher;
import android.media.IRingtonePlayer;
import android.media.IStrategyPreferredDevicesDispatcher;
-import android.media.ISpatializerCallback;
import android.media.IVolumeController;
import android.media.IVolumeController;
import android.media.PlayerBase;
@@ -398,24 +396,4 @@
void registerModeDispatcher(IAudioModeDispatcher dispatcher);
oneway void unregisterModeDispatcher(IAudioModeDispatcher dispatcher);
-
- int getSpatializerImmersiveAudioLevel();
-
- boolean isSpatializerEnabled();
-
- void setSpatializerFeatureEnabled(boolean enabled);
-
- void setSpatializerEnabledForDevice(boolean enabled, in AudioDeviceAttributes device);
-
- boolean canBeSpatialized(in AudioAttributes aa, in AudioFormat af);
-
- void registerSpatializerCallback(in ISpatializerCallback callback);
-
- void unregisterSpatializerCallback(in ISpatializerCallback callback);
-
- List<AudioDeviceAttributes> getSpatializerCompatibleAudioDevices();
-
- void addSpatializerCompatibleAudioDevice(in AudioDeviceAttributes ada);
-
- void removeSpatializerCompatibleAudioDevice(in AudioDeviceAttributes ada);
}
diff --git a/media/java/android/media/ISpatializerCallback.aidl b/media/java/android/media/ISpatializerCallback.aidl
deleted file mode 100644
index 50c5a6b8..0000000
--- a/media/java/android/media/ISpatializerCallback.aidl
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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 android.media;
-
-/**
- * AIDL for the AudioService to signal Spatializer state changes.
- *
- * {@hide}
- */
-oneway interface ISpatializerCallback {
-
- void dispatchSpatializerStateChanged(boolean enabled);
-
-}
diff --git a/media/java/android/media/MediaMuxer.java b/media/java/android/media/MediaMuxer.java
index ac19c21..b8e7930e 100644
--- a/media/java/android/media/MediaMuxer.java
+++ b/media/java/android/media/MediaMuxer.java
@@ -69,17 +69,14 @@
<h4>Metadata Track</h4>
<p>
- Per-frame metadata is useful in carrying extra information that correlated with video or audio to
- facilitate offline processing, e.g. gyro signals from the sensor could help video stabilization when
- doing offline processing. Metadata track is only supported in MP4 container. When adding a new
- metadata track, track's mime format must start with prefix "application/", e.g. "applicaton/gyro".
- Metadata's format/layout will be defined by the application. Writing metadata is nearly the same as
- writing video/audio data except that the data will not be from mediacodec. Application just needs
- to pass the bytebuffer that contains the metadata and also the associated timestamp to the
- {@link #writeSampleData} api. The timestamp must be in the same time base as video and audio. The
- generated MP4 file uses TextMetaDataSampleEntry defined in section 12.3.3.2 of the ISOBMFF to signal
- the metadata's mime format. When using{@link android.media.MediaExtractor} to extract the file with
- metadata track, the mime format of the metadata will be extracted into {@link android.media.MediaFormat}.
+ Per-frame metadata carries information that correlates with video or audio to facilitate offline
+ processing. For example, gyro signals from the sensor can help video stabilization when doing
+ offline processing. Metadata tracks are only supported when multiplexing to the MP4 container
+ format. When adding a new metadata track, the MIME type format must start with prefix
+ "application/" (for example, "application/gyro"). The format of the metadata is
+ application-defined. Metadata timestamps must be in the same time base as video and audio
+ timestamps. The generated MP4 file uses TextMetaDataSampleEntry (defined in section 12.3.3.2 of
+ the ISOBMFF specification) to signal the metadata's MIME type.
<pre class=prettyprint>
MediaMuxer muxer = new MediaMuxer("temp.mp4", OutputFormat.MUXER_OUTPUT_MPEG_4);
diff --git a/media/java/android/media/Spatializer.java b/media/java/android/media/Spatializer.java
deleted file mode 100644
index a2267cc..0000000
--- a/media/java/android/media/Spatializer.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * 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 android.media;
-
-import android.annotation.CallbackExecutor;
-import android.annotation.IntDef;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.annotation.RequiresPermission;
-import android.annotation.SystemApi;
-import android.media.permission.ClearCallingIdentityContext;
-import android.media.permission.SafeCloseable;
-import android.os.RemoteException;
-
-import com.android.internal.annotations.GuardedBy;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-import java.util.concurrent.Executor;
-
-/**
- * Spatializer provides access to querying capabilities and behavior of sound spatialization
- * on the device.
- * Sound spatialization simulates sounds originating around the listener as if they were coming
- * from virtual speakers placed around the listener.<br>
- * Support for spatialization is optional, use {@link AudioManager#getSpatializer()} to obtain an
- * instance of this class if the feature is supported.
- *
- */
-public class Spatializer {
-
- private final @NonNull AudioManager mAm;
-
- private final Object mStateListenerLock = new Object();
-
- /**
- * List of listeners for state listener and their associated Executor.
- * List is lazy-initialized on first registration
- */
- @GuardedBy("mStateListenerLock")
- private @Nullable ArrayList<StateListenerInfo> mStateListeners;
-
- @GuardedBy("mStateListenerLock")
- private SpatializerInfoDispatcherStub mInfoDispatcherStub;
-
- /**
- * @hide
- * Constructor with AudioManager acting as proxy to AudioService
- * @param am a non-null AudioManager
- */
- protected Spatializer(@NonNull AudioManager am) {
- mAm = Objects.requireNonNull(am);
- }
-
- /**
- * Returns whether spatialization is enabled or not.
- * A false value can originate from a number of sources, examples are the user electing to
- * disable the feature, or the use of an audio device that is not compatible with multichannel
- * audio spatialization (for instance playing audio over a monophonic speaker).
- * @return {@code true} if spatialization is enabled
- */
- public boolean isEnabled() {
- return mAm.isSpatializerEnabled();
- }
-
- /** @hide */
- @IntDef(flag = false, value = {
- SPATIALIZER_IMMERSIVE_LEVEL_NONE,
- SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL,
- })
- @Retention(RetentionPolicy.SOURCE)
- public @interface ImmersiveAudioLevel {};
-
- /**
- * @hide
- * Constant indicating there are no spatialization capabilities supported on this device.
- * @see AudioManager#getImmersiveAudioLevel()
- */
- public static final int SPATIALIZER_IMMERSIVE_LEVEL_NONE = 0;
-
- /**
- * @hide
- * Constant indicating the {@link Spatializer} on this device supports multichannel
- * spatialization.
- * @see AudioManager#getImmersiveAudioLevel()
- */
- public static final int SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL = 1;
-
-
- /**
- * @hide
- * @param enabled
- * @param device
- */
- //TODO make as API if needed for UX, remove otherwise
- //@SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
- //@RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
- public void setEnabledForDevice(boolean enabled,
- @NonNull AudioDeviceAttributes device) {
- Objects.requireNonNull(device);
- mAm.setSpatializerEnabledForDevice(enabled, device);
- }
-
- /**
- * @hide
- * Enables / disables the spatializer effect
- * @param enabled {@code true} for enabling the effect
- */
- //TODO make as API if needed for UX, remove otherwise
- //@SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
- @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
- public void setEnabled(boolean enabled) {
- mAm.setSpatializerFeatureEnabled(enabled);
- }
-
- /**
- * An interface to be notified of changes to the state of the spatializer.
- */
- public interface OnSpatializerEnabledChangedListener {
- /**
- * Called when the enabled state of the Spatializer changes
- * @param enabled {@code true} if the Spatializer effect is enabled on the device,
- * {@code false} otherwise
- */
- void onSpatializerEnabledChanged(boolean enabled);
- }
-
- /**
- * Returns whether audio of the given {@link AudioFormat}, played with the given
- * {@link AudioAttributes} can be spatialized.
- * Note that the result reflects the capabilities of the device and may change when
- * audio accessories are connected/disconnected (e.g. wired headphones plugged in or not).
- * The result is independent from whether spatialization processing is enabled or not.
- * @param attributes the {@code AudioAttributes} of the content as used for playback
- * @param format the {@code AudioFormat} of the content as used for playback
- * @return true if the device is capable of spatializing the combination of audio format and
- * attributes.
- */
- public boolean canBeSpatialized(
- @NonNull AudioAttributes attributes, @NonNull AudioFormat format) {
- return mAm.canBeSpatialized(
- Objects.requireNonNull(attributes), Objects.requireNonNull(format));
- }
-
- /**
- * Adds a listener to be notified of changes to the enabled state of the
- * {@code Spatializer}.
- * @see #isEnabled()
- * @param executor the {@code Executor} handling the callback
- * @param listener the listener to receive enabled state updates
- */
- public void addOnSpatializerEnabledChangedListener(
- @NonNull @CallbackExecutor Executor executor,
- @NonNull OnSpatializerEnabledChangedListener listener) {
- Objects.requireNonNull(executor);
- Objects.requireNonNull(listener);
- synchronized (mStateListenerLock) {
- if (hasSpatializerStateListener(listener)) {
- throw new IllegalArgumentException(
- "Called addOnSpatializerEnabledChangedListener() "
- + "on a previously registered listener");
- }
- // lazy initialization of the list of strategy-preferred device listener
- if (mStateListeners == null) {
- mStateListeners = new ArrayList<>();
- }
- mStateListeners.add(new StateListenerInfo(listener, executor));
- if (mStateListeners.size() == 1) {
- // register binder for callbacks
- if (mInfoDispatcherStub == null) {
- mInfoDispatcherStub =
- new SpatializerInfoDispatcherStub();
- }
- try {
- mAm.getService().registerSpatializerCallback(
- mInfoDispatcherStub);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
- }
- }
- }
-
- /**
- * Removes a previously added listener for changes to the enabled state of the
- * {@code Spatializer}.
- * @see #isEnabled()
- * @param listener the listener to receive enabled state updates
- */
- public void removeOnSpatializerEnabledChangedListener(
- @NonNull OnSpatializerEnabledChangedListener listener) {
- Objects.requireNonNull(listener);
- synchronized (mStateListenerLock) {
- if (!removeStateListener(listener)) {
- throw new IllegalArgumentException(
- "Called removeOnSpatializerEnabledChangedListener() "
- + "on an unregistered listener");
- }
- if (mStateListeners.size() == 0) {
- // unregister binder for callbacks
- try {
- mAm.getService().unregisterSpatializerCallback(mInfoDispatcherStub);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- } finally {
- mInfoDispatcherStub = null;
- mStateListeners = null;
- }
- }
- }
- }
-
- /**
- * @hide
- * Returns the list of playback devices that are compatible with the playback of multichannel
- * audio through virtualization
- * @return a list of devices. An empty list indicates virtualization is not supported.
- */
- @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
- @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
- public @NonNull List<AudioDeviceAttributes> getCompatibleAudioDevices() {
- return mAm.getSpatializerCompatibleAudioDevices();
- }
-
- /**
- * @hide
- * Adds a playback device to the list of devices compatible with the playback of multichannel
- * audio through spatialization.
- * @see #getCompatibleAudioDevices()
- * @param ada the audio device compatible with spatialization
- */
- @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
- @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
- public void addCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- mAm.addSpatializerCompatibleAudioDevice(Objects.requireNonNull(ada));
- }
-
- /**
- * @hide
- * Remove a playback device from the list of devices compatible with the playback of
- * multichannel audio through spatialization.
- * @see #getCompatibleAudioDevices()
- * @param ada the audio device incompatible with spatialization
- */
- @SystemApi(client = SystemApi.Client.PRIVILEGED_APPS)
- @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_ROUTING)
- public void removeCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- mAm.removeSpatializerCompatibleAudioDevice(Objects.requireNonNull(ada));
- }
-
- private final class SpatializerInfoDispatcherStub
- extends ISpatializerCallback.Stub {
- @Override
- public void dispatchSpatializerStateChanged(boolean enabled) {
- // make a shallow copy of listeners so callback is not executed under lock
- final ArrayList<StateListenerInfo> stateListeners;
- synchronized (mStateListenerLock) {
- if (mStateListeners == null || mStateListeners.size() == 0) {
- return;
- }
- stateListeners = (ArrayList<StateListenerInfo>) mStateListeners.clone();
- }
- try (SafeCloseable ignored = ClearCallingIdentityContext.create()) {
- for (StateListenerInfo info : stateListeners) {
- info.mExecutor.execute(() ->
- info.mListener.onSpatializerEnabledChanged(enabled));
- }
- }
- }
- }
-
- private static class StateListenerInfo {
- final @NonNull OnSpatializerEnabledChangedListener mListener;
- final @NonNull Executor mExecutor;
-
- StateListenerInfo(@NonNull OnSpatializerEnabledChangedListener listener,
- @NonNull Executor exe) {
- mListener = listener;
- mExecutor = exe;
- }
- }
-
- @GuardedBy("mStateListenerLock")
- private boolean hasSpatializerStateListener(OnSpatializerEnabledChangedListener listener) {
- return getStateListenerInfo(listener) != null;
- }
-
- @GuardedBy("mStateListenerLock")
- private @Nullable StateListenerInfo getStateListenerInfo(
- OnSpatializerEnabledChangedListener listener) {
- if (mStateListeners == null) {
- return null;
- }
- for (StateListenerInfo info : mStateListeners) {
- if (info.mListener == listener) {
- return info;
- }
- }
- return null;
- }
-
- @GuardedBy("mStateListenerLock")
- /**
- * @return true if the listener was removed from the list
- */
- private boolean removeStateListener(OnSpatializerEnabledChangedListener listener) {
- final StateListenerInfo infoToRemove = getStateListenerInfo(listener);
- if (infoToRemove != null) {
- mStateListeners.remove(infoToRemove);
- return true;
- }
- return false;
- }
-}
diff --git a/media/java/android/media/tv/tuner/Tuner.java b/media/java/android/media/tv/tuner/Tuner.java
index ed5e6ee..3118220 100644
--- a/media/java/android/media/tv/tuner/Tuner.java
+++ b/media/java/android/media/tv/tuner/Tuner.java
@@ -1146,13 +1146,13 @@
}
}
- private void onFrequenciesReport(int[] frequency) {
+ private void onFrequenciesReport(long[] frequencies) {
synchronized (mScanCallbackLock) {
if (mScanCallbackExecutor != null && mScanCallback != null) {
mScanCallbackExecutor.execute(() -> {
synchronized (mScanCallbackLock) {
if (mScanCallback != null) {
- mScanCallback.onFrequenciesReported(frequency);
+ mScanCallback.onFrequenciesLongReported(frequencies);
}
}
});
diff --git a/media/java/android/media/tv/tuner/filter/Filter.java b/media/java/android/media/tv/tuner/filter/Filter.java
index e7612bc..bd860d9 100644
--- a/media/java/android/media/tv/tuner/filter/Filter.java
+++ b/media/java/android/media/tv/tuner/filter/Filter.java
@@ -333,6 +333,7 @@
/**
* Gets the filter Id in 32-bit. For any Tuner SoC that supports 64-bit filter architecture,
* use {@link #getIdLong()}.
+ * @deprecated Use {@link #getIdLong()} for both 32-bit and 64-bit filter architectures.
*/
public int getId() {
synchronized (mLock) {
@@ -342,8 +343,7 @@
}
/**
- * Gets the 64-bit filter Id. For any Tuner SoC that supports 32-bit filter architecture,
- * use {@link #getId()}.
+ * Gets the filter Id.
*/
public long getIdLong() {
synchronized (mLock) {
diff --git a/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
index 768f1d3..e0405ef 100644
--- a/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/AnalogFrontendSettings.java
@@ -229,7 +229,7 @@
return new Builder();
}
- private AnalogFrontendSettings(int frequency, int signalType, int sifStandard, int aftFlag) {
+ private AnalogFrontendSettings(long frequency, int signalType, int sifStandard, int aftFlag) {
super(frequency);
mSignalType = signalType;
mSifStandard = sifStandard;
@@ -240,7 +240,7 @@
* Builder for {@link AnalogFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mSignalType = SIGNAL_TYPE_UNDEFINED;
private int mSifStandard = SIF_UNDEFINED;
private int mAftFlag = AFT_FLAG_UNDEFINED;
@@ -251,10 +251,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/Atsc3FrontendSettings.java b/media/java/android/media/tv/tuner/frontend/Atsc3FrontendSettings.java
index 52a20cb..a7157e2 100644
--- a/media/java/android/media/tv/tuner/frontend/Atsc3FrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/Atsc3FrontendSettings.java
@@ -276,8 +276,8 @@
private final int mDemodOutputFormat;
private final Atsc3PlpSettings[] mPlpSettings;
- private Atsc3FrontendSettings(int frequency, int bandwidth, int demodOutputFormat,
- Atsc3PlpSettings[] plpSettings) {
+ private Atsc3FrontendSettings(
+ long frequency, int bandwidth, int demodOutputFormat, Atsc3PlpSettings[] plpSettings) {
super(frequency);
mBandwidth = bandwidth;
mDemodOutputFormat = demodOutputFormat;
@@ -319,7 +319,7 @@
* Builder for {@link Atsc3FrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mBandwidth = BANDWIDTH_UNDEFINED;
private int mDemodOutputFormat = DEMOD_OUTPUT_FORMAT_UNDEFINED;
private Atsc3PlpSettings[] mPlpSettings = {};
@@ -331,10 +331,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/AtscFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/AtscFrontendSettings.java
index 042bba8..3071ce8 100644
--- a/media/java/android/media/tv/tuner/frontend/AtscFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/AtscFrontendSettings.java
@@ -61,7 +61,7 @@
private final int mModulation;
- private AtscFrontendSettings(int frequency, int modulation) {
+ private AtscFrontendSettings(long frequency, int modulation) {
super(frequency);
mModulation = modulation;
}
@@ -86,7 +86,7 @@
* Builder for {@link AtscFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mModulation = MODULATION_UNDEFINED;
private Builder() {
@@ -96,10 +96,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/DtmbFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/DtmbFrontendSettings.java
index 9ba41d5..91102d4 100644
--- a/media/java/android/media/tv/tuner/frontend/DtmbFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/DtmbFrontendSettings.java
@@ -247,7 +247,7 @@
private final int mGuardInterval;
private final int mTimeInterleaveMode;
- private DtmbFrontendSettings(int frequency, int modulation, int codeRate, int transmissionMode,
+ private DtmbFrontendSettings(long frequency, int modulation, int codeRate, int transmissionMode,
int guardInterval, int timeInterleaveMode, int bandwidth) {
super(frequency);
mModulation = modulation;
@@ -319,7 +319,7 @@
* Builder for {@link AtscFrontendSettings}.
*/
public static final class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mModulation = MODULATION_CONSTELLATION_UNDEFINED;
private int mCodeRate = CODERATE_UNDEFINED;
private int mTransmissionMode = TRANSMISSION_MODE_UNDEFINED;
@@ -334,11 +334,24 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
+ */
+ @NonNull
+ @IntRange(from = 1)
+ @Deprecated
+ public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
*/
@NonNull
@IntRange(from = 1)
@SuppressLint("MissingGetterMatchingBuilder")
- public Builder setFrequency(int frequency) {
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/DvbcFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/DvbcFrontendSettings.java
index b209d97..afe953d 100644
--- a/media/java/android/media/tv/tuner/frontend/DvbcFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/DvbcFrontendSettings.java
@@ -266,7 +266,7 @@
// Dvbc bandwidth is only supported in Tuner 1.1 or higher.
private final int mBandwidth;
- private DvbcFrontendSettings(int frequency, int modulation, long innerFec, int symbolRate,
+ private DvbcFrontendSettings(long frequency, int modulation, long innerFec, int symbolRate,
int outerFec, int annex, int spectralInversion, int interleaveMode, int bandwidth) {
super(frequency);
mModulation = modulation;
@@ -347,7 +347,7 @@
* Builder for {@link DvbcFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mModulation = MODULATION_UNDEFINED;
private long mInnerFec = FEC_UNDEFINED;
private int mSymbolRate = 0;
@@ -364,10 +364,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
index 6e3d98a..e16f192 100644
--- a/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/DvbsFrontendSettings.java
@@ -263,7 +263,7 @@
// isDiseqcRxMessage is only supported in Tuner 1.1 or higher.
private final boolean mIsDiseqcRxMessage;
- private DvbsFrontendSettings(int frequency, int modulation, DvbsCodeRate codeRate,
+ private DvbsFrontendSettings(long frequency, int modulation, DvbsCodeRate codeRate,
int symbolRate, int rolloff, int pilot, int inputStreamId, int standard, int vcm,
int scanType, boolean isDiseqcRxMessage) {
super(frequency);
@@ -363,7 +363,7 @@
* Builder for {@link DvbsFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mModulation = MODULATION_UNDEFINED;
private DvbsCodeRate mCodeRate = null;
private int mSymbolRate = 0;
@@ -382,10 +382,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/DvbtFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/DvbtFrontendSettings.java
index 5735b39..d86e9a8 100644
--- a/media/java/android/media/tv/tuner/frontend/DvbtFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/DvbtFrontendSettings.java
@@ -399,7 +399,7 @@
private final int mPlpId;
private final int mPlpGroupId;
- private DvbtFrontendSettings(int frequency, int transmissionMode, int bandwidth,
+ private DvbtFrontendSettings(long frequency, int transmissionMode, int bandwidth,
int constellation, int hierarchy, int hpCodeRate, int lpCodeRate, int guardInterval,
boolean isHighPriority, int standard, boolean isMiso, int plpMode, int plpId,
int plpGroupId) {
@@ -532,7 +532,7 @@
* Builder for {@link DvbtFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mTransmissionMode = TRANSMISSION_MODE_UNDEFINED;
private int mBandwidth = BANDWIDTH_UNDEFINED;
private int mConstellation = CONSTELLATION_UNDEFINED;
@@ -554,10 +554,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/FrontendInfo.java b/media/java/android/media/tv/tuner/frontend/FrontendInfo.java
index e96cae6..5cabb71 100644
--- a/media/java/android/media/tv/tuner/frontend/FrontendInfo.java
+++ b/media/java/android/media/tv/tuner/frontend/FrontendInfo.java
@@ -34,15 +34,15 @@
public class FrontendInfo {
private final int mId;
private final int mType;
- private final Range<Integer> mFrequencyRange;
+ private final Range<Long> mFrequencyRange;
private final Range<Integer> mSymbolRateRange;
- private final int mAcquireRange;
+ private final long mAcquireRange;
private final int mExclusiveGroupId;
private final int[] mStatusCaps;
private final FrontendCapabilities mFrontendCap;
- private FrontendInfo(int id, int type, int minFrequency, int maxFrequency, int minSymbolRate,
- int maxSymbolRate, int acquireRange, int exclusiveGroupId, int[] statusCaps,
+ private FrontendInfo(int id, int type, long minFrequency, long maxFrequency, int minSymbolRate,
+ int maxSymbolRate, long acquireRange, int exclusiveGroupId, int[] statusCaps,
FrontendCapabilities frontendCap) {
mId = id;
mType = type;
@@ -77,9 +77,21 @@
/**
* Gets supported frequency range in Hz.
+ *
+ * @deprecated Use {@link #getFrequencyRangeLong()}
*/
+ @Deprecated
@NonNull
public Range<Integer> getFrequencyRange() {
+ return new Range<>(
+ (int) (long) mFrequencyRange.getLower(), (int) (long) mFrequencyRange.getUpper());
+ }
+
+ /**
+ * Gets supported frequency range in Hz.
+ */
+ @NonNull
+ public Range<Long> getFrequencyRangeLong() {
return mFrequencyRange;
}
@@ -95,10 +107,22 @@
* Gets acquire range in Hz.
*
* <p>The maximum frequency difference the frontend can detect.
+ @deprecated Use {@link #getAcquireRangeLong(long)}
*/
+ @Deprecated
public int getAcquireRange() {
+ return (int) getAcquireRangeLong();
+ }
+
+ /**
+ * Gets acquire range in Hz.
+ *
+ * <p>The maximum frequency difference the frontend can detect.
+ */
+ public long getAcquireRangeLong() {
return mAcquireRange;
}
+
/**
* Gets exclusive group ID.
*
@@ -108,6 +132,7 @@
public int getExclusiveGroupId() {
return mExclusiveGroupId;
}
+
/**
* Gets status capabilities.
*
@@ -118,6 +143,7 @@
public int[] getStatusCapabilities() {
return mStatusCaps;
}
+
/**
* Gets frontend capabilities.
*/
@@ -126,7 +152,6 @@
return mFrontendCap;
}
-
/** @hide */
@Override
public boolean equals(Object o) {
@@ -139,9 +164,9 @@
// TODO: compare FrontendCapabilities
FrontendInfo info = (FrontendInfo) o;
return mId == info.getId() && mType == info.getType()
- && Objects.equals(mFrequencyRange, info.getFrequencyRange())
+ && Objects.equals(mFrequencyRange, info.getFrequencyRangeLong())
&& Objects.equals(mSymbolRateRange, info.getSymbolRateRange())
- && mAcquireRange == info.getAcquireRange()
+ && mAcquireRange == info.getAcquireRangeLong()
&& mExclusiveGroupId == info.getExclusiveGroupId()
&& Arrays.equals(mStatusCaps, info.getStatusCapabilities());
}
diff --git a/media/java/android/media/tv/tuner/frontend/FrontendSettings.java b/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
index 4a31686..38bffec 100644
--- a/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/FrontendSettings.java
@@ -271,17 +271,13 @@
public static final int FRONTEND_SPECTRAL_INVERSION_INVERTED =
android.hardware.tv.tuner.FrontendSpectralInversion.INVERTED;
-
-
- private final int mFrequency;
+ private final long mFrequency;
// End frequency is only supported in Tuner 1.1 or higher.
- private int mEndFrequency = Tuner.INVALID_FRONTEND_SETTING_FREQUENCY;
+ private long mEndFrequency = Tuner.INVALID_FRONTEND_SETTING_FREQUENCY;
// General spectral inversion is only supported in Tuner 1.1 or higher.
private int mSpectralInversion = FRONTEND_SPECTRAL_INVERSION_UNDEFINED;
- FrontendSettings(int frequency) {
- mFrequency = frequency;
- }
+ FrontendSettings(long frequency) { mFrequency = frequency; }
/**
* Returns the frontend type.
@@ -293,8 +289,19 @@
* Gets the frequency.
*
* @return the frequency in Hz.
+ * @deprecated Use {@link #getFrequencyLong()}
*/
+ @Deprecated
public int getFrequency() {
+ return (int) getFrequencyLong();
+ }
+
+ /**
+ * Gets the frequency.
+ *
+ * @return the frequency in Hz.
+ */
+ public long getFrequencyLong() {
return mFrequency;
}
@@ -302,9 +309,21 @@
* Get the end frequency.
*
* @return the end frequency in Hz.
+ * @deprecated Use {@link #getEndFrequencyLong()}
+ */
+ @Deprecated
+ @IntRange(from = 1)
+ public int getEndFrequency() {
+ return (int) getEndFrequencyLong();
+ }
+
+ /**
+ * Get the end frequency.
+ *
+ * @return the end frequency in Hz.
*/
@IntRange(from = 1)
- public int getEndFrequency() {
+ public long getEndFrequencyLong() {
return mEndFrequency;
}
@@ -344,9 +363,27 @@
* @param endFrequency the end frequency used during blind scan. The default value is
* {@link android.media.tv.tuner.Tuner#INVALID_FRONTEND_SETTING_FREQUENCY}.
* @throws IllegalArgumentException if the {@code endFrequency} is not greater than 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@IntRange(from = 1)
- public void setEndFrequency(int endFrequency) {
+ @Deprecated
+ public void setEndFrequency(int frequency) {
+ setEndFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Set End Frequency. This API is only supported with Tuner HAL 1.1 or higher. Otherwise it
+ * would be no-op.
+ *
+ * <p>This API is only supported by Tuner HAL 1.1 or higher. Unsupported version would cause
+ * no-op. Use {@link TunerVersionChecker#getTunerVersion()} to check the version.
+ *
+ * @param endFrequency the end frequency used during blind scan. The default value is
+ * {@link android.media.tv.tuner.Tuner#INVALID_FRONTEND_SETTING_FREQUENCY}.
+ * @throws IllegalArgumentException if the {@code endFrequency} is not greater than 0.
+ */
+ @IntRange(from = 1)
+ public void setEndFrequencyLong(long endFrequency) {
if (TunerVersionChecker.checkHigherOrEqualVersionTo(
TunerVersionChecker.TUNER_VERSION_1_1, "setEndFrequency")) {
if (endFrequency < 1) {
diff --git a/media/java/android/media/tv/tuner/frontend/FrontendStatus.java b/media/java/android/media/tv/tuner/frontend/FrontendStatus.java
index 36fd942..53adc75 100644
--- a/media/java/android/media/tv/tuner/frontend/FrontendStatus.java
+++ b/media/java/android/media/tv/tuner/frontend/FrontendStatus.java
@@ -447,7 +447,7 @@
private Boolean mIsLnaOn;
private boolean[] mIsLayerErrors;
private Integer mMer;
- private Integer mFreqOffset;
+ private Long mFreqOffset;
private Integer mHierarchy;
private Boolean mIsRfLocked;
private Atsc3PlpTuningInfo[] mPlpInfo;
@@ -651,8 +651,18 @@
* Gets the current frequency difference in Hz.
*
* <p>Difference between tuning frequency and actual locked frequency.
+ * @deprecated Use {@link #getFreqOffsetLong()}
*/
+ @Deprecated
public int getFreqOffset() {
+ return (int) getFreqOffsetLong();
+ }
+ /**
+ * Gets the current frequency difference in Hz.
+ *
+ * <p>Difference between tuning frequency and actual locked frequency.
+ */
+ public long getFreqOffsetLong() {
if (mFreqOffset == null) {
throw new IllegalStateException("FreqOffset status is empty");
}
diff --git a/media/java/android/media/tv/tuner/frontend/Isdbs3FrontendSettings.java b/media/java/android/media/tv/tuner/frontend/Isdbs3FrontendSettings.java
index 14b0b02..726fe15 100644
--- a/media/java/android/media/tv/tuner/frontend/Isdbs3FrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/Isdbs3FrontendSettings.java
@@ -158,7 +158,7 @@
private final int mSymbolRate;
private final int mRolloff;
- private Isdbs3FrontendSettings(int frequency, int streamId, int streamIdType, int modulation,
+ private Isdbs3FrontendSettings(long frequency, int streamId, int streamIdType, int modulation,
int codeRate, int symbolRate, int rolloff) {
super(frequency);
mStreamId = streamId;
@@ -222,7 +222,7 @@
* Builder for {@link Isdbs3FrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mStreamId = Tuner.INVALID_STREAM_ID;
private int mStreamIdType = IsdbsFrontendSettings.STREAM_ID_TYPE_ID;
private int mModulation = MODULATION_UNDEFINED;
@@ -237,10 +237,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/IsdbsFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/IsdbsFrontendSettings.java
index aab6408..51ec5ae 100644
--- a/media/java/android/media/tv/tuner/frontend/IsdbsFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/IsdbsFrontendSettings.java
@@ -143,7 +143,7 @@
private final int mSymbolRate;
private final int mRolloff;
- private IsdbsFrontendSettings(int frequency, int streamId, int streamIdType, int modulation,
+ private IsdbsFrontendSettings(long frequency, int streamId, int streamIdType, int modulation,
int codeRate, int symbolRate, int rolloff) {
super(frequency);
mStreamId = streamId;
@@ -207,7 +207,7 @@
* Builder for {@link IsdbsFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mStreamId = Tuner.INVALID_STREAM_ID;
private int mStreamIdType = STREAM_ID_TYPE_ID;
private int mModulation = MODULATION_UNDEFINED;
@@ -222,10 +222,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/IsdbtFrontendSettings.java b/media/java/android/media/tv/tuner/frontend/IsdbtFrontendSettings.java
index de2476a..d34b643 100644
--- a/media/java/android/media/tv/tuner/frontend/IsdbtFrontendSettings.java
+++ b/media/java/android/media/tv/tuner/frontend/IsdbtFrontendSettings.java
@@ -134,7 +134,7 @@
private final int mGuardInterval;
private final int mServiceAreaId;
- private IsdbtFrontendSettings(int frequency, int modulation, int bandwidth, int mode,
+ private IsdbtFrontendSettings(long frequency, int modulation, int bandwidth, int mode,
int codeRate, int guardInterval, int serviceAreaId) {
super(frequency);
mModulation = modulation;
@@ -199,7 +199,7 @@
* Builder for {@link IsdbtFrontendSettings}.
*/
public static class Builder {
- private int mFrequency = 0;
+ private long mFrequency = 0;
private int mModulation = MODULATION_UNDEFINED;
private int mBandwidth = BANDWIDTH_UNDEFINED;
private int mMode = MODE_UNDEFINED;
@@ -214,10 +214,23 @@
* Sets frequency in Hz.
*
* <p>Default value is 0.
+ * @deprecated Use {@link #setFrequencyLong(long)}
*/
@NonNull
@IntRange(from = 1)
+ @Deprecated
public Builder setFrequency(int frequency) {
+ return setFrequencyLong((long) frequency);
+ }
+
+ /**
+ * Sets frequency in Hz.
+ *
+ * <p>Default value is 0.
+ */
+ @NonNull
+ @IntRange(from = 1)
+ public Builder setFrequencyLong(long frequency) {
mFrequency = frequency;
return this;
}
diff --git a/media/java/android/media/tv/tuner/frontend/ScanCallback.java b/media/java/android/media/tv/tuner/frontend/ScanCallback.java
index 27627d7..f61bd52 100644
--- a/media/java/android/media/tv/tuner/frontend/ScanCallback.java
+++ b/media/java/android/media/tv/tuner/frontend/ScanCallback.java
@@ -37,8 +37,19 @@
/** scan progress percent (0..100) */
void onProgress(@IntRange(from = 0, to = 100) int percent);
+ /**
+ * @deprecated Use {@link #onFrequenciesLongReported(long[])}
+ */
+ @Deprecated void onFrequenciesReported(@NonNull int[] frequencies);
+
/** Signal frequencies in Hertz */
- void onFrequenciesReported(@NonNull int[] frequency);
+ default void onFrequenciesLongReported(@NonNull long[] frequencies) {
+ final int[] intFrequencies = new int[frequencies.length];
+ for (int i = 0; i < frequencies.length; i++) {
+ intFrequencies[i] = (int) frequencies[i];
+ }
+ onFrequenciesReported(intFrequencies);
+ }
/** Symbols per second */
void onSymbolRatesReported(@NonNull int[] rate);
diff --git a/media/jni/android_media_tv_Tuner.cpp b/media/jni/android_media_tv_Tuner.cpp
index f1c72f8..4bee485 100644
--- a/media/jni/android_media_tv_Tuner.cpp
+++ b/media/jni/android_media_tv_Tuner.cpp
@@ -978,24 +978,16 @@
}
case FrontendScanMessageType::FREQUENCY: {
std::vector<int64_t> v = message.get<FrontendScanMessage::Tag::frequencies>();
- std::vector<uint32_t> jintV;
- for (int i = 0; i < v.size(); i++) {
- jintV.push_back(static_cast<uint32_t>(v[i]));
- }
- jintArray freqs = env->NewIntArray(jintV.size());
- env->SetIntArrayRegion(freqs, 0, v.size(), reinterpret_cast<jint *>(&jintV[0]));
-
- env->CallVoidMethod(
- frontend,
- env->GetMethodID(clazz, "onFrequenciesReport", "([I)V"),
- freqs);
+ jlongArray freqs = env->NewLongArray(v.size());
+ env->SetLongArrayRegion(freqs, 0, v.size(), reinterpret_cast<jlong *>(&v[0]));
+ env->CallVoidMethod(frontend, env->GetMethodID(clazz, "onFrequenciesReport", "([J)V"),
+ freqs);
break;
}
case FrontendScanMessageType::SYMBOL_RATE: {
std::vector<int32_t> v = message.get<FrontendScanMessage::Tag::symbolRates>();
jintArray symbolRates = env->NewIntArray(v.size());
env->SetIntArrayRegion(symbolRates, 0, v.size(), reinterpret_cast<jint *>(&v[0]));
-
env->CallVoidMethod(frontend, env->GetMethodID(clazz, "onSymbolRates", "([I)V"),
symbolRates);
break;
@@ -1384,15 +1376,16 @@
JNIEnv *env = AndroidRuntime::getJNIEnv();
jclass clazz = env->FindClass("android/media/tv/tuner/frontend/FrontendInfo");
- jmethodID infoInit = env->GetMethodID(clazz, "<init>",
- "(IIIIIIII[ILandroid/media/tv/tuner/frontend/FrontendCapabilities;)V");
+ jmethodID infoInit =
+ env->GetMethodID(clazz, "<init>",
+ "(IIJJIIJI[ILandroid/media/tv/tuner/frontend/FrontendCapabilities;)V");
jint type = (jint)feInfo->type;
- jint minFrequency = static_cast<uint32_t>(feInfo->minFrequency);
- jint maxFrequency = static_cast<uint32_t>(feInfo->maxFrequency);
+ jlong minFrequency = feInfo->minFrequency;
+ jlong maxFrequency = feInfo->maxFrequency;
jint minSymbolRate = feInfo->minSymbolRate;
jint maxSymbolRate = feInfo->maxSymbolRate;
- jint acquireRange = feInfo->acquireRange;
+ jlong acquireRange = feInfo->acquireRange;
jint exclusiveGroupId = feInfo->exclusiveGroupId;
jintArray statusCaps = env->NewIntArray(feInfo->statusCaps.size());
env->SetIntArrayRegion(
@@ -1854,6 +1847,8 @@
jmethodID initInt = env->GetMethodID(intClazz, "<init>", "(I)V");
jclass booleanClazz = env->FindClass("java/lang/Boolean");
jmethodID initBoolean = env->GetMethodID(booleanClazz, "<init>", "(Z)V");
+ jclass longClazz = env->FindClass("java/lang/Long");
+ jmethodID initLong = env->GetMethodID(longClazz, "<init>", "(J)V");
for (int i = 0; i < status.size(); i++) {
const FrontendStatus &s = status[i];
@@ -2033,12 +2028,10 @@
break;
}
case FrontendStatus::Tag::freqOffset: {
- jfieldID field = env->GetFieldID(clazz, "mFreqOffset", "Ljava/lang/Integer;");
- jobject newIntegerObj =
- env->NewObject(intClazz, initInt,
- static_cast<uint32_t>(
- s.get<FrontendStatus::Tag::freqOffset>()));
- env->SetObjectField(statusObj, field, newIntegerObj);
+ jfieldID field = env->GetFieldID(clazz, "mFreqOffset", "Ljava/lang/Long;");
+ jobject newLongObj = env->NewObject(longClazz, initLong,
+ s.get<FrontendStatus::Tag::freqOffset>());
+ env->SetObjectField(statusObj, field, newLongObj);
break;
}
case FrontendStatus::Tag::hierarchy: {
@@ -2480,14 +2473,14 @@
static int64_t getFrontendSettingsFreq(JNIEnv *env, const jobject &settings) {
jclass clazz = env->FindClass("android/media/tv/tuner/frontend/FrontendSettings");
- jfieldID freqField = env->GetFieldID(clazz, "mFrequency", "I");
- return static_cast<uint32_t>(env->GetIntField(settings, freqField));
+ jfieldID freqField = env->GetFieldID(clazz, "mFrequency", "J");
+ return env->GetLongField(settings, freqField);
}
static int64_t getFrontendSettingsEndFreq(JNIEnv *env, const jobject &settings) {
jclass clazz = env->FindClass("android/media/tv/tuner/frontend/FrontendSettings");
- jfieldID endFreqField = env->GetFieldID(clazz, "mEndFrequency", "I");
- return static_cast<uint32_t>(env->GetIntField(settings, endFreqField));
+ jfieldID endFreqField = env->GetFieldID(clazz, "mEndFrequency", "J");
+ return env->GetLongField(settings, endFreqField);
}
static FrontendSpectralInversion getFrontendSettingsSpectralInversion(
diff --git a/packages/SystemUI/res-keyguard/values-sw600dp-land/donottranslate.xml b/packages/SystemUI/res-keyguard/values-sw600dp-land/donottranslate.xml
new file mode 100644
index 0000000..1a52e93
--- /dev/null
+++ b/packages/SystemUI/res-keyguard/values-sw600dp-land/donottranslate.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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.
+ -->
+
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Don't use the smaller PIN pad keys if we have the screen space to support it. -->
+ <string name="num_pad_key_ratio">1.0</string>
+</resources>
diff --git a/packages/SystemUI/res/color/docked_divider_background.xml b/packages/SystemUI/res/color/docked_divider_background.xml
new file mode 100644
index 0000000..85ede9a
--- /dev/null
+++ b/packages/SystemUI/res/color/docked_divider_background.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="@android:color/system_neutral2_500" android:lStar="35" />
+</selector>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index 38af659..b5ac0c6 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -152,7 +152,6 @@
<!-- Chosen so fill over background matches single tone -->
<color name="dark_mode_qs_icon_color_dual_tone_fill">#99000000</color>
- <color name="docked_divider_background">#ff000000</color>
<color name="docked_divider_handle">#ffffff</color>
<drawable name="forced_resizable_background">#59000000</drawable>
<color name="minimize_dock_shadow_start">#60000000</color>
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 4f857ed..fa73eaf 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -1148,7 +1148,7 @@
<!-- The maximum offset in either direction that elements are moved vertically to prevent
burn-in on AOD. -->
- <dimen name="burn_in_prevention_offset_y_large_clock">42dp</dimen>
+ <dimen name="burn_in_prevention_offset_y_clock">42dp</dimen>
<!-- Clock maximum font size (dp is intentional, to prevent any further scaling) -->
<dimen name="large_clock_text_size">150dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
index 7450eb6..f593ed2 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java
@@ -18,6 +18,7 @@
import android.app.INotificationManager;
import android.content.Context;
+import android.view.LayoutInflater;
import androidx.annotation.Nullable;
@@ -26,6 +27,7 @@
import com.android.keyguard.dagger.KeyguardBouncerComponent;
import com.android.systemui.BootCompleteCache;
import com.android.systemui.BootCompleteCacheImpl;
+import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.appops.dagger.AppOpsModule;
import com.android.systemui.assist.AssistModule;
@@ -62,6 +64,7 @@
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.StatusBar;
+import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.statusbar.phone.dagger.StatusBarComponent;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -70,6 +73,7 @@
import com.android.systemui.statusbar.policy.dagger.StatusBarPolicyModule;
import com.android.systemui.tuner.dagger.TunerModule;
import com.android.systemui.user.UserModule;
+import com.android.systemui.util.InjectionInflationController;
import com.android.systemui.util.concurrency.SysUIConcurrencyModule;
import com.android.systemui.util.dagger.UtilModule;
import com.android.systemui.util.sensors.SensorModule;
@@ -200,4 +204,19 @@
groupManager, entryManager, notifPipeline, sysUiState, featureFlags, dumpManager,
sysuiMainExecutor));
}
+
+ @Provides
+ @SysUISingleton
+ static StatusBarWindowView providesStatusBarWindowView(Context context,
+ InjectionInflationController injectionInflationController) {
+ StatusBarWindowView view =
+ (StatusBarWindowView) injectionInflationController.injectable(
+ LayoutInflater.from(context)).inflate(R.layout.super_status_bar,
+ /* root= */ null);
+ if (view == null) {
+ throw new IllegalStateException(
+ "R.layout.super_status_bar could not be properly inflated");
+ }
+ return view;
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/idle/IdleHostViewController.java b/packages/SystemUI/src/com/android/systemui/idle/IdleHostViewController.java
index 97d32c3..192c4184a 100644
--- a/packages/SystemUI/src/com/android/systemui/idle/IdleHostViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/idle/IdleHostViewController.java
@@ -39,6 +39,7 @@
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.ViewController;
@@ -139,6 +140,9 @@
// Monitor for tracking touches for activity.
private InputMonitorCompat mInputMonitor;
+ // Input receiver of touch activities.
+ private InputChannelCompat.InputEventReceiver mInputEventReceiver;
+
// Intent filter for receiving dream broadcasts.
private IntentFilter mDreamIntentFilter;
@@ -335,7 +339,7 @@
}
private void enableIdleMonitoring(boolean enable) {
- if (enable && mInputMonitor == null) {
+ if (enable && mInputMonitor == null && mInputEventReceiver == null) {
if (DEBUG) {
Log.d(TAG, "enable idle monitoring");
}
@@ -345,7 +349,7 @@
// Monitor - any input should reset timer
mInputMonitor = mInputMonitorFactory.getInputMonitor(INPUT_MONITOR_IDENTIFIER);
- mInputMonitor.getInputReceiver(mLooper, mChoreographer,
+ mInputEventReceiver = mInputMonitor.getInputReceiver(mLooper, mChoreographer,
v -> {
if (DEBUG) {
Log.d(TAG, "touch detected, resetting timeout");
@@ -358,7 +362,7 @@
mCancelEnableIdling = mDelayableExecutor.executeDelayed(
mEnableIdlingCallback, mIdleTimeout);
});
- } else if (!enable && mInputMonitor != null) {
+ } else if (!enable && mInputMonitor != null && mInputEventReceiver != null) {
if (DEBUG) {
Log.d(TAG, "disable idle monitoring");
}
@@ -368,7 +372,9 @@
mCancelEnableIdling = null;
}
+ mInputEventReceiver.dispose();
mInputMonitor.dispose();
+ mInputEventReceiver = null;
mInputMonitor = null;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
index aaa3bf0..2bf4bf4 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java
@@ -106,7 +106,7 @@
static final String DEBUG_MISSING_GESTURE_TAG = "NoBackGesture";
private static final boolean ENABLE_PER_WINDOW_INPUT_ROTATION =
- SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
+ SystemProperties.getBoolean("persist.debug.per_window_input_rotation", true);
private ISystemGestureExclusionListener mGestureExclusionListener =
new ISystemGestureExclusionListener.Stub() {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt b/packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt
index bedb330..4f87cad 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/FooterActionsController.kt
@@ -213,5 +213,13 @@
mView.setKeyguardShowing()
}
+ fun refreshVisibility(shouldBeVisible: Boolean) {
+ if (shouldBeVisible) {
+ showFooter()
+ } else {
+ hideFooter()
+ }
+ }
+
private fun isTunerEnabled() = tunerService.isTunerEnabled
}
\ No newline at end of file
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
index 0da4814..42323e3 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelControllerBase.java
@@ -84,15 +84,15 @@
public void onConfigurationChange(Configuration newConfig) {
mShouldUseSplitNotificationShade =
Utils.shouldUseSplitNotificationShade(getResources());
+ onConfigurationChanged();
if (newConfig.orientation != mLastOrientation) {
mLastOrientation = newConfig.orientation;
- onScreenRotated();
switchTileLayout(false);
}
}
};
- protected void onScreenRotated() { }
+ protected void onConfigurationChanged() { }
private final Function1<Boolean, Unit> mMediaHostVisibilityListener = (visible) -> {
if (mMediaVisibilityChangedListener != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
index 921ee35..92690c7d 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickQSPanelController.java
@@ -81,7 +81,7 @@
mMediaHost.init(MediaHierarchyManager.LOCATION_QQS);
mBrightnessController.init(mShouldUseSplitNotificationShade);
mFooterActionsController.init();
- refreshFooterVisibility();
+ mFooterActionsController.refreshVisibility(mShouldUseSplitNotificationShade);
}
@Override
@@ -109,14 +109,6 @@
return mView.isListening();
}
- private void refreshFooterVisibility() {
- if (mShouldUseSplitNotificationShade) {
- mFooterActionsController.showFooter();
- } else {
- mFooterActionsController.hideFooter();
- }
- }
-
private void setMaxTiles(int parseNumTiles) {
mView.setMaxTiles(parseNumTiles);
setTiles();
@@ -129,9 +121,9 @@
}
@Override
- protected void onScreenRotated() {
+ protected void onConfigurationChanged() {
mBrightnessController.refreshVisibility(mShouldUseSplitNotificationShade);
- refreshFooterVisibility();
+ mFooterActionsController.refreshVisibility(mShouldUseSplitNotificationShade);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java b/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java
deleted file mode 100644
index e4ae560..0000000
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2019 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.systemui.statusbar;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.ViewGroup;
-
-import com.android.systemui.R;
-import com.android.systemui.dagger.SysUISingleton;
-import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
-import com.android.systemui.statusbar.phone.NotificationPanelView;
-import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
-import com.android.systemui.statusbar.phone.StatusBarWindowView;
-import com.android.systemui.util.InjectionInflationController;
-
-import javax.inject.Inject;
-
-/**
- * Creates a single instance of super_status_bar and super_notification_shade that can be shared
- * across various system ui objects.
- */
-@SysUISingleton
-public class SuperStatusBarViewFactory {
-
- private final Context mContext;
- private final InjectionInflationController mInjectionInflationController;
- private final NotificationShelfComponent.Builder mNotificationShelfComponentBuilder;
-
- private NotificationShadeWindowView mNotificationShadeWindowView;
- private StatusBarWindowView mStatusBarWindowView;
- private NotificationShelfController mNotificationShelfController;
-
- @Inject
- public SuperStatusBarViewFactory(Context context,
- InjectionInflationController injectionInflationController,
- NotificationShelfComponent.Builder notificationShelfComponentBuilder) {
- mContext = context;
- mInjectionInflationController = injectionInflationController;
- mNotificationShelfComponentBuilder = notificationShelfComponentBuilder;
- }
-
- /**
- * Gets the inflated {@link NotificationShadeWindowView} from
- * {@link R.layout#super_notification_shade}.
- * Returns a cached instance, if it has already been inflated.
- */
- public NotificationShadeWindowView getNotificationShadeWindowView() {
- if (mNotificationShadeWindowView != null) {
- return mNotificationShadeWindowView;
- }
-
- mNotificationShadeWindowView = (NotificationShadeWindowView)
- mInjectionInflationController.injectable(
- LayoutInflater.from(mContext)).inflate(R.layout.super_notification_shade,
- /* root= */ null);
- if (mNotificationShadeWindowView == null) {
- throw new IllegalStateException(
- "R.layout.super_notification_shade could not be properly inflated");
- }
-
- return mNotificationShadeWindowView;
- }
-
- /**
- * Gets the inflated {@link StatusBarWindowView} from {@link R.layout#super_status_bar}.
- * Returns a cached instance, if it has already been inflated.
- */
- public StatusBarWindowView getStatusBarWindowView() {
- if (mStatusBarWindowView != null) {
- return mStatusBarWindowView;
- }
-
- mStatusBarWindowView =
- (StatusBarWindowView) mInjectionInflationController.injectable(
- LayoutInflater.from(mContext)).inflate(R.layout.super_status_bar,
- /* root= */ null);
- if (mStatusBarWindowView == null) {
- throw new IllegalStateException(
- "R.layout.super_status_bar could not be properly inflated");
- }
- return mStatusBarWindowView;
- }
-
- /**
- * Gets the inflated {@link NotificationShelf} from
- * {@link R.layout#status_bar_notification_shelf}.
- * Returns a cached instance, if it has already been inflated.
- *
- * @param container the expected container to hold the {@link NotificationShelf}. The view
- * isn't immediately attached, but the layout params of this view is used
- * during inflation.
- */
- public NotificationShelfController getNotificationShelfController(ViewGroup container) {
- if (mNotificationShelfController != null) {
- return mNotificationShelfController;
- }
-
- NotificationShelf view = (NotificationShelf) LayoutInflater.from(mContext)
- .inflate(R.layout.status_bar_notification_shelf, container, /* attachToRoot= */
- false);
-
- if (view == null) {
- throw new IllegalStateException(
- "R.layout.status_bar_notification_shelf could not be properly inflated");
- }
-
- NotificationShelfComponent component = mNotificationShelfComponentBuilder
- .notificationShelf(view)
- .build();
- mNotificationShelfController = component.getNotificationShelfController();
- mNotificationShelfController.init();
-
- return mNotificationShelfController;
- }
-
- public NotificationPanelView getNotificationPanelView() {
- NotificationShadeWindowView notificationShadeWindowView = getNotificationShadeWindowView();
- if (notificationShadeWindowView == null) {
- return null;
- }
-
- return mNotificationShadeWindowView.findViewById(R.id.notification_panel);
- }
-}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
index 7291b5a..589446f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/SystemEventChipAnimationController.kt
@@ -24,13 +24,10 @@
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.FrameLayout
-
import com.android.systemui.R
-import com.android.systemui.statusbar.SuperStatusBarViewFactory
import com.android.systemui.statusbar.phone.StatusBarLocationPublisher
import com.android.systemui.statusbar.phone.StatusBarWindowController
import com.android.systemui.statusbar.phone.StatusBarWindowView
-
import javax.inject.Inject
/**
@@ -38,7 +35,7 @@
*/
class SystemEventChipAnimationController @Inject constructor(
private val context: Context,
- private val statusBarViewFactory: SuperStatusBarViewFactory,
+ private val statusBarWindowView: StatusBarWindowView,
private val statusBarWindowController: StatusBarWindowController,
private val locationPublisher: StatusBarLocationPublisher
) : SystemStatusChipAnimationCallback {
@@ -51,7 +48,6 @@
private lateinit var animationWindowView: FrameLayout
private lateinit var animationDotView: View
- private lateinit var statusBarWindowView: StatusBarWindowView
private var currentAnimatedView: View? = null
// TODO: move to dagger
@@ -125,7 +121,6 @@
private fun init() {
initialized = true
- statusBarWindowView = statusBarViewFactory.statusBarWindowView
animationWindowView = LayoutInflater.from(context)
.inflate(R.layout.system_event_animation_window, null) as FrameLayout
animationDotView = animationWindowView.findViewById(R.id.dot_view)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.kt
index 07618da..12ae3f1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ConfigurationControllerImpl.kt
@@ -17,6 +17,7 @@
import android.content.Context
import android.content.pm.ActivityInfo
import android.content.res.Configuration
+import android.graphics.Rect
import android.os.LocaleList
import android.view.View.LAYOUT_DIRECTION_RTL
import com.android.systemui.statusbar.policy.ConfigurationController
@@ -29,6 +30,7 @@
private val lastConfig = Configuration()
private var density: Int = 0
private var smallestScreenWidth: Int = 0
+ private var maxBounds: Rect? = null
private var fontScale: Float = 0.toFloat()
private val inCarMode: Boolean
private var uiMode: Int = 0
@@ -85,6 +87,14 @@
}
}
+ val maxBounds = newConfig.windowConfiguration.maxBounds
+ if (maxBounds != this.maxBounds) {
+ this.maxBounds = maxBounds
+ listeners.filterForEach({ this.listeners.contains(it) }) {
+ it.onMaxBoundsChanged()
+ }
+ }
+
val localeList = newConfig.locales
if (localeList != this.localeList) {
this.localeList = localeList
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
index f77c052..d348954 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java
@@ -32,12 +32,6 @@
* Utility class to calculate the clock position and top padding of notifications on Keyguard.
*/
public class KeyguardClockPositionAlgorithm {
- /**
- * How much the clock height influences the shade position.
- * 0 means nothing, 1 means move the shade up by the height of the clock
- * 0.5f means move the shade up by half of the size of the clock.
- */
- private static float CLOCK_HEIGHT_WEIGHT = 0.7f;
/**
* Margin between the bottom of the status view and the notification shade.
@@ -45,11 +39,6 @@
private int mStatusViewBottomMargin;
/**
- * Height of the parent view - display size in px.
- */
- private int mHeight;
-
- /**
* Height of {@link KeyguardStatusView}.
*/
private int mKeyguardStatusHeight;
@@ -68,21 +57,6 @@
private int mUserSwitchPreferredY;
/**
- * Whether or not there is a custom clock face on keyguard.
- */
- private boolean mHasCustomClock;
-
- /**
- * Whether or not the NSSL contains any visible notifications.
- */
- private boolean mHasVisibleNotifs;
-
- /**
- * Height of notification stack: Sum of height of each notification.
- */
- private int mNotificationStackHeight;
-
- /**
* Minimum top margin to avoid overlap with status bar, lock icon, or multi-user switcher
* avatar.
*/
@@ -94,12 +68,6 @@
private int mCutoutTopInset = 0;
/**
- * Maximum bottom padding to avoid overlap with {@link KeyguardBottomAreaView} or
- * the ambient indication.
- */
- private int mMaxShadeBottom;
-
- /**
* Recommended distance from the status bar.
*/
private int mContainerTopPadding;
@@ -115,14 +83,9 @@
private int mBurnInPreventionOffsetX;
/**
- * Burn-in prevention y translation.
+ * Burn-in prevention y translation for clock layouts.
*/
- private int mBurnInPreventionOffsetY;
-
- /**
- * Burn-in prevention y translation for large clock layouts.
- */
- private int mBurnInPreventionOffsetYLargeClock;
+ private int mBurnInPreventionOffsetYClock;
/**
* Doze/AOD transition amount.
@@ -160,34 +123,26 @@
res.getDimensionPixelSize(R.dimen.keyguard_clock_top_margin) / 2;
mBurnInPreventionOffsetX = res.getDimensionPixelSize(
R.dimen.burn_in_prevention_offset_x);
- mBurnInPreventionOffsetY = res.getDimensionPixelSize(
- R.dimen.burn_in_prevention_offset_y);
- mBurnInPreventionOffsetYLargeClock = res.getDimensionPixelSize(
- R.dimen.burn_in_prevention_offset_y_large_clock);
+ mBurnInPreventionOffsetYClock = res.getDimensionPixelSize(
+ R.dimen.burn_in_prevention_offset_y_clock);
}
/**
* Sets up algorithm values.
*/
- public void setup(int keyguardStatusBarHeaderHeight, int maxShadeBottom,
- int notificationStackHeight, float panelExpansion, int parentHeight,
+ public void setup(int keyguardStatusBarHeaderHeight, float panelExpansion,
int keyguardStatusHeight, int userSwitchHeight, int userSwitchPreferredY,
- boolean hasCustomClock, boolean hasVisibleNotifs, float dark,
- float overStrechAmount, boolean bypassEnabled, int unlockedStackScrollerPadding,
- float qsExpansion, int cutoutTopInset, boolean isSplitShade) {
+ float dark, float overStretchAmount, boolean bypassEnabled,
+ int unlockedStackScrollerPadding, float qsExpansion, int cutoutTopInset,
+ boolean isSplitShade) {
mMinTopMargin = keyguardStatusBarHeaderHeight + Math.max(mContainerTopPadding,
userSwitchHeight);
- mMaxShadeBottom = maxShadeBottom;
- mNotificationStackHeight = notificationStackHeight;
mPanelExpansion = panelExpansion;
- mHeight = parentHeight;
mKeyguardStatusHeight = keyguardStatusHeight + mStatusViewBottomMargin;
mUserSwitchHeight = userSwitchHeight;
mUserSwitchPreferredY = userSwitchPreferredY;
- mHasCustomClock = hasCustomClock;
- mHasVisibleNotifs = hasVisibleNotifs;
mDarkAmount = dark;
- mOverStretchAmount = overStrechAmount;
+ mOverStretchAmount = overStretchAmount;
mBypassEnabled = bypassEnabled;
mUnlockedStackScrollerPadding = unlockedStackScrollerPadding;
mQsExpansion = qsExpansion;
@@ -244,8 +199,8 @@
// This will keep the clock at the top but out of the cutout area
float shift = 0;
- if (clockY - mBurnInPreventionOffsetYLargeClock < mCutoutTopInset) {
- shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYLargeClock);
+ if (clockY - mBurnInPreventionOffsetYClock < mCutoutTopInset) {
+ shift = mCutoutTopInset - (clockY - mBurnInPreventionOffsetYClock);
}
float clockYDark = clockY + burnInPreventionOffsetY() + shift;
@@ -281,7 +236,7 @@
}
private float burnInPreventionOffsetY() {
- int offset = mBurnInPreventionOffsetYLargeClock;
+ int offset = mBurnInPreventionOffsetYClock;
return getBurnInOffset(offset * 2, false /* xAxis */) - offset;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
index b5eb90e..4ce3375 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java
@@ -1406,8 +1406,6 @@
}
private void updateClockAppearance() {
- int totalHeight = mView.getHeight();
- int bottomPadding = Math.max(mIndicationBottomPadding, mAmbientIndicationBottomPadding);
int userSwitcherPreferredY = mStatusBarHeaderHeightKeyguard;
boolean bypassEnabled = mKeyguardBypassController.getBypassEnabled();
final boolean hasVisibleNotifications = mNotificationStackScrollLayoutController
@@ -1428,14 +1426,11 @@
mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()
? 1.0f : mInterpolatedDarkAmount;
mClockPositionAlgorithm.setup(mStatusBarHeaderHeightKeyguard,
- totalHeight - bottomPadding,
- mNotificationStackScrollLayoutController.getIntrinsicContentHeight(),
expandedFraction,
- totalHeight,
mKeyguardStatusViewController.getLockscreenHeight(),
userIconHeight,
- userSwitcherPreferredY, hasCustomClock(),
- hasVisibleNotifications, darkamount, mOverStretchAmount,
+ userSwitcherPreferredY,
+ darkamount, mOverStretchAmount,
bypassEnabled, getUnlockedStackScrollerPadding(),
computeQsExpansionFraction(),
mDisplayTopInset,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
index e57e200..147ebfb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewController.java
@@ -47,7 +47,6 @@
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.PulseExpansionHandler;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -106,7 +105,7 @@
private boolean mExpandingBelowNotch;
private final DockManager mDockManager;
private final NotificationPanelViewController mNotificationPanelViewController;
- private final SuperStatusBarViewFactory mStatusBarViewFactory;
+ private final StatusBarWindowView mStatusBarWindowView;
// Used for determining view / touch intersection
private int[] mTempLocation = new int[2];
@@ -136,7 +135,7 @@
NotificationShadeDepthController depthController,
NotificationShadeWindowView notificationShadeWindowView,
NotificationPanelViewController notificationPanelViewController,
- SuperStatusBarViewFactory statusBarViewFactory,
+ StatusBarWindowView statusBarWindowView,
NotificationStackScrollLayoutController notificationStackScrollLayoutController,
StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
mInjectionInflationController = injectionInflationController;
@@ -160,7 +159,7 @@
mDockManager = dockManager;
mNotificationPanelViewController = notificationPanelViewController;
mDepthController = depthController;
- mStatusBarViewFactory = statusBarViewFactory;
+ mStatusBarWindowView = statusBarWindowView;
mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
@@ -477,11 +476,10 @@
public void setStatusBarView(PhoneStatusBarView statusBarView) {
mStatusBarView = statusBarView;
- if (statusBarView != null && mStatusBarViewFactory != null) {
+ if (statusBarView != null) {
mBarTransitions = new PhoneStatusBarTransitions(
statusBarView,
- mStatusBarViewFactory.getStatusBarWindowView()
- .findViewById(R.id.status_bar_container));
+ mStatusBarWindowView.findViewById(R.id.status_bar_container));
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index f07f619..0f6ad1ce 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -194,7 +194,6 @@
import com.android.systemui.statusbar.PowerButtonReveal;
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarState;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
@@ -228,11 +227,11 @@
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
+import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
-import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.SplashscreenContentDrawer;
@@ -248,7 +247,6 @@
import java.util.concurrent.Executor;
import javax.inject.Named;
-import javax.inject.Provider;
import dagger.Lazy;
@@ -459,7 +457,6 @@
private final Point mCurrentDisplaySize = new Point();
protected NotificationShadeWindowView mNotificationShadeWindowView;
- protected StatusBarWindowView mPhoneStatusBarWindow;
protected PhoneStatusBarView mStatusBarView;
private PhoneStatusBarViewController mPhoneStatusBarViewController;
private AuthRippleController mAuthRippleController;
@@ -491,13 +488,13 @@
protected NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private final DozeParameters mDozeParameters;
private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
- private final Provider<StatusBarComponent.Builder> mStatusBarComponentBuilder;
+ private final StatusBarComponent.Factory mStatusBarComponentFactory;
private final PluginManager mPluginManager;
private final Optional<LegacySplitScreen> mSplitScreenOptional;
private final StatusBarNotificationActivityStarter.Builder
mStatusBarNotificationActivityStarterBuilder;
private final ShadeController mShadeController;
- private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
+ private final StatusBarWindowView mStatusBarWindowView;
private final LightsOutNotifController mLightsOutNotifController;
private final InitController mInitController;
@@ -744,14 +741,14 @@
DozeScrimController dozeScrimController,
VolumeComponent volumeComponent,
CommandQueue commandQueue,
- Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
+ StatusBarComponent.Factory statusBarComponentFactory,
PluginManager pluginManager,
Optional<LegacySplitScreen> splitScreenOptional,
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
statusBarNotificationActivityStarterBuilder,
ShadeController shadeController,
- SuperStatusBarViewFactory superStatusBarViewFactory,
+ StatusBarWindowView statusBarWindowView,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
ViewMediatorCallback viewMediatorCallback,
InitController initController,
@@ -841,12 +838,12 @@
mNotificationShadeDepthControllerLazy = notificationShadeDepthControllerLazy;
mVolumeComponent = volumeComponent;
mCommandQueue = commandQueue;
- mStatusBarComponentBuilder = statusBarComponentBuilder;
+ mStatusBarComponentFactory = statusBarComponentFactory;
mPluginManager = pluginManager;
mSplitScreenOptional = splitScreenOptional;
mStatusBarNotificationActivityStarterBuilder = statusBarNotificationActivityStarterBuilder;
mShadeController = shadeController;
- mSuperStatusBarViewFactory = superStatusBarViewFactory;
+ mStatusBarWindowView = statusBarWindowView;
mLightsOutNotifController = lightsOutNotifController;
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
mKeyguardViewMediatorCallback = viewMediatorCallback;
@@ -1108,14 +1105,10 @@
// TODO: Deal with the ugliness that comes from having some of the statusbar broken out
// into fragments, but the rest here, it leaves some awkward lifecycle and whatnot.
- mStackScrollerController =
- mNotificationPanelViewController.getNotificationStackScrollLayoutController();
- mStackScroller = mStackScrollerController.getView();
NotificationListContainer notifListContainer =
mStackScrollerController.getNotificationListContainer();
mNotificationLogger.setUpWithContainer(notifListContainer);
- inflateShelf();
mNotificationIconAreaController.setupShelf(mNotificationShelfController);
mNotificationPanelViewController.addExpansionListener(mWakeUpCoordinator);
mNotificationPanelViewController.addExpansionListener(
@@ -1124,7 +1117,7 @@
// Allow plugins to reference DarkIconDispatcher and StatusBarStateController
mPluginDependencyProvider.allowPluginDependency(DarkIconDispatcher.class);
mPluginDependencyProvider.allowPluginDependency(StatusBarStateController.class);
- FragmentHostManager.get(mPhoneStatusBarWindow)
+ FragmentHostManager.get(mStatusBarWindowView)
.addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {
CollapsedStatusBarFragment statusBarFragment =
(CollapsedStatusBarFragment) fragment;
@@ -1542,24 +1535,20 @@
};
}
- private void inflateShelf() {
- mNotificationShelfController = mSuperStatusBarViewFactory
- .getNotificationShelfController(mStackScroller);
- }
-
private void inflateStatusBarWindow() {
- mNotificationShadeWindowView = mSuperStatusBarViewFactory.getNotificationShadeWindowView();
- StatusBarComponent statusBarComponent = mStatusBarComponentBuilder.get()
- .statusBarWindowView(mNotificationShadeWindowView).build();
+ StatusBarComponent statusBarComponent = mStatusBarComponentFactory.create();
+ mNotificationShadeWindowView = statusBarComponent.getNotificationShadeWindowView();
mNotificationShadeWindowViewController = statusBarComponent
.getNotificationShadeWindowViewController();
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
mNotificationShadeWindowViewController.setupExpandedStatusBar();
mStatusBarWindowController = statusBarComponent.getStatusBarWindowController();
- mPhoneStatusBarWindow = mSuperStatusBarViewFactory.getStatusBarWindowView();
mNotificationPanelViewController = statusBarComponent.getNotificationPanelViewController();
statusBarComponent.getLockIconViewController().init();
+ mStackScrollerController = statusBarComponent.getNotificationStackScrollLayoutController();
+ mStackScroller = mStackScrollerController.getView();
+ mNotificationShelfController = statusBarComponent.getNotificationShelfController();
mAuthRippleController = statusBarComponent.getAuthRippleController();
mAuthRippleController.init();
@@ -1634,7 +1623,7 @@
}
public StatusBarWindowView getStatusBarWindow() {
- return mPhoneStatusBarWindow;
+ return mStatusBarWindowView;
}
public NotificationShadeWindowViewController getNotificationShadeWindowViewController() {
@@ -2587,7 +2576,7 @@
private ActivityLaunchAnimator.Controller wrapAnimationController(
ActivityLaunchAnimator.Controller animationController, boolean dismissShade) {
View rootView = animationController.getLaunchContainer().getRootView();
- if (rootView == mSuperStatusBarViewFactory.getStatusBarWindowView()) {
+ if (rootView == mStatusBarWindowView) {
// We are animating a view in the status bar. We have to make sure that the status bar
// window matches the full screen during the animation and that we are expanding the
// view below the other status bar text.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
index 1dd22b4..515094b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProvider.kt
@@ -19,10 +19,10 @@
import android.content.Context
import android.content.res.Resources
import android.graphics.Rect
+import android.util.LruCache
import android.util.Pair
import android.view.DisplayCutout
import android.view.View.LAYOUT_DIRECTION_RTL
-import android.view.WindowManager
import android.view.WindowMetrics
import androidx.annotation.VisibleForTesting
import com.android.systemui.Dumpable
@@ -37,6 +37,7 @@
import com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE
import com.android.systemui.util.leak.RotationUtils.ROTATION_UPSIDE_DOWN
import com.android.systemui.util.leak.RotationUtils.Rotation
+import com.android.systemui.util.leak.RotationUtils.getResourcesForRotation
import java.io.FileDescriptor
import java.io.PrintWriter
import java.lang.Math.max
@@ -60,13 +61,14 @@
class StatusBarContentInsetsProvider @Inject constructor(
val context: Context,
val configurationController: ConfigurationController,
- val windowManager: WindowManager,
val dumpManager: DumpManager
) : CallbackController<StatusBarContentInsetsChangedListener>,
ConfigurationController.ConfigurationListener,
Dumpable {
- // Indexed by @Rotation
- private val insetsByCorner = arrayOfNulls<Rect>(4)
+
+ // Limit cache size as potentially we may connect large number of displays
+ // (e.g. network displays)
+ private val insetsCache = LruCache<CacheKey, Rect>(MAX_CACHE_SIZE)
private val listeners = mutableSetOf<StatusBarContentInsetsChangedListener>()
init {
@@ -90,12 +92,12 @@
clearCachedInsets()
}
- private fun clearCachedInsets() {
- insetsByCorner[0] = null
- insetsByCorner[1] = null
- insetsByCorner[2] = null
- insetsByCorner[3] = null
+ override fun onMaxBoundsChanged() {
+ notifyInsetsChanged()
+ }
+ private fun clearCachedInsets() {
+ insetsCache.evictAll()
notifyInsetsChanged()
}
@@ -110,10 +112,10 @@
* dot in the coordinates relative to the given rotation.
*/
fun getBoundingRectForPrivacyChipForRotation(@Rotation rotation: Int): Rect {
- var insets = insetsByCorner[rotation]
- val rotatedResources = RotationUtils.getResourcesForRotation(rotation, context)
+ var insets = insetsCache[getCacheKey(rotation = rotation)]
+ val rotatedResources = getResourcesForRotation(rotation, context)
if (insets == null) {
- insets = getAndSetInsetsForRotation(rotation, rotatedResources)
+ insets = getStatusBarContentInsetsForRotation(rotation, rotatedResources)
}
val dotWidth = rotatedResources.getDimensionPixelSize(R.dimen.ongoing_appops_dot_diameter)
@@ -128,24 +130,16 @@
* Calculates the necessary left and right locations for the status bar contents invariant of
* the current device rotation, in the target rotation's coordinates
*/
- fun getStatusBarContentInsetsForRotation(@Rotation rotation: Int): Rect {
- var insets = insetsByCorner[rotation]
- if (insets == null) {
- val rotatedResources = RotationUtils.getResourcesForRotation(rotation, context)
- insets = getAndSetInsetsForRotation(rotation, rotatedResources)
- }
-
- return insets
- }
-
- private fun getAndSetInsetsForRotation(
- @Rotation rot: Int,
- rotatedResources: Resources
+ @JvmOverloads
+ fun getStatusBarContentInsetsForRotation(
+ @Rotation rotation: Int,
+ rotatedResources: Resources = getResourcesForRotation(rotation, context)
): Rect {
- val insets = getCalculatedInsetsForRotation(rot, rotatedResources)
- insetsByCorner[rot] = insets
-
- return insets
+ val key = getCacheKey(rotation = rotation)
+ return insetsCache[key] ?: getCalculatedInsetsForRotation(rotation, rotatedResources)
+ .also {
+ insetsCache.put(key, it)
+ }
}
private fun getCalculatedInsetsForRotation(
@@ -175,17 +169,29 @@
currentRotation,
targetRotation,
dc,
- windowManager.maximumWindowMetrics,
+ context.resources.configuration.windowConfiguration.maxBounds,
rotatedResources.getDimensionPixelSize(R.dimen.status_bar_height),
minLeft,
minRight)
}
override fun dump(fd: FileDescriptor, pw: PrintWriter, args: Array<out String>) {
- insetsByCorner.forEachIndexed { index, rect ->
- pw.println("${RotationUtils.toString(index)} -> $rect")
+ insetsCache.snapshot().forEach { (key, rect) ->
+ pw.println("$key -> $rect")
}
+ pw.println(insetsCache)
}
+
+ private fun getCacheKey(@Rotation rotation: Int): CacheKey =
+ CacheKey(
+ uniqueDisplayId = context.display.uniqueId,
+ rotation = rotation
+ )
+
+ private data class CacheKey(
+ val uniqueDisplayId: String,
+ @Rotation val rotation: Int
+ )
}
interface StatusBarContentInsetsChangedListener {
@@ -193,10 +199,9 @@
}
private const val TAG = "StatusBarInsetsProvider"
+private const val MAX_CACHE_SIZE = 16
-private fun getRotationZeroDisplayBounds(wm: WindowMetrics, @Rotation exactRotation: Int): Rect {
- val bounds = wm.bounds
-
+private fun getRotationZeroDisplayBounds(bounds: Rect, @Rotation exactRotation: Int): Rect {
if (exactRotation == ROTATION_NONE || exactRotation == ROTATION_UPSIDE_DOWN) {
return bounds
}
@@ -242,7 +247,7 @@
@Rotation currentRotation: Int,
@Rotation targetRotation: Int,
displayCutout: DisplayCutout?,
- windowMetrics: WindowMetrics,
+ maxBounds: Rect,
statusBarHeight: Int,
minLeft: Int,
minRight: Int
@@ -253,16 +258,15 @@
val right = if (isRtl) paddingStart else paddingEnd
*/
- val rotZeroBounds = getRotationZeroDisplayBounds(windowMetrics, currentRotation)
- val currentBounds = windowMetrics.bounds
+ val rotZeroBounds = getRotationZeroDisplayBounds(maxBounds, currentRotation)
val sbLeftRight = getStatusBarLeftRight(
displayCutout,
statusBarHeight,
rotZeroBounds.right,
rotZeroBounds.bottom,
- currentBounds.width(),
- currentBounds.height(),
+ maxBounds.width(),
+ maxBounds.height(),
minLeft,
minRight,
targetRotation,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
index 3d3b58a..aec27d0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowController.java
@@ -43,7 +43,6 @@
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Main;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import javax.inject.Inject;
@@ -58,14 +57,13 @@
private final Context mContext;
private final WindowManager mWindowManager;
private final IWindowManager mIWindowManager;
- private final SuperStatusBarViewFactory mSuperStatusBarViewFactory;
private final StatusBarContentInsetsProvider mContentInsetsProvider;
private final Resources mResources;
private int mBarHeight = -1;
private final State mCurrentState = new State();
- private ViewGroup mStatusBarView;
- private ViewGroup mLaunchAnimationContainer;
+ private final ViewGroup mStatusBarView;
+ private final ViewGroup mLaunchAnimationContainer;
private WindowManager.LayoutParams mLp;
private final WindowManager.LayoutParams mLpChanged;
@@ -74,15 +72,14 @@
Context context,
WindowManager windowManager,
IWindowManager iWindowManager,
- SuperStatusBarViewFactory superStatusBarViewFactory,
+ StatusBarWindowView statusBarWindowView,
StatusBarContentInsetsProvider contentInsetsProvider,
@Main Resources resources) {
mContext = context;
mWindowManager = windowManager;
mIWindowManager = iWindowManager;
mContentInsetsProvider = contentInsetsProvider;
- mSuperStatusBarViewFactory = superStatusBarViewFactory;
- mStatusBarView = mSuperStatusBarViewFactory.getStatusBarWindowView();
+ mStatusBarView = statusBarWindowView;
mLaunchAnimationContainer = mStatusBarView.findViewById(
R.id.status_bar_launch_animation_container);
mLpChanged = new WindowManager.LayoutParams();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
index d408c0c..418f588 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarComponent.java
@@ -20,6 +20,8 @@
import com.android.keyguard.LockIconViewController;
import com.android.systemui.biometrics.AuthRippleController;
+import com.android.systemui.statusbar.NotificationShelfController;
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.NotificationPanelViewController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController;
@@ -34,7 +36,6 @@
import javax.inject.Scope;
-import dagger.BindsInstance;
import dagger.Subcomponent;
/**
@@ -46,11 +47,9 @@
/**
* Builder for {@link StatusBarComponent}.
*/
- @Subcomponent.Builder
- interface Builder {
- @BindsInstance Builder statusBarWindowView(
- NotificationShadeWindowView notificationShadeWindowView);
- StatusBarComponent build();
+ @Subcomponent.Factory
+ interface Factory {
+ StatusBarComponent create();
}
/**
@@ -62,6 +61,21 @@
@interface StatusBarScope {}
/**
+ * Creates a {@link NotificationShadeWindowView}/
+ * @return
+ */
+ @StatusBarScope
+ NotificationShadeWindowView getNotificationShadeWindowView();
+
+ /** */
+ @StatusBarScope
+ NotificationShelfController getNotificationShelfController();
+
+ /** */
+ @StatusBarScope
+ NotificationStackScrollLayoutController getNotificationStackScrollLayoutController();
+
+ /**
* Creates a NotificationShadeWindowViewController.
*/
@StatusBarScope
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
index b36c45e..a7b57b9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.java
@@ -58,7 +58,6 @@
import com.android.systemui.statusbar.NotificationViewHierarchyManager;
import com.android.systemui.statusbar.OperatorNameViewController;
import com.android.systemui.statusbar.PulseExpansionHandler;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
@@ -92,6 +91,7 @@
import com.android.systemui.statusbar.phone.StatusBarLocationPublisher;
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarter;
import com.android.systemui.statusbar.phone.StatusBarTouchableRegionManager;
+import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallController;
import com.android.systemui.statusbar.policy.BatteryController;
@@ -104,11 +104,11 @@
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
+import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
-import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.StartingSurface;
@@ -117,7 +117,6 @@
import java.util.concurrent.Executor;
import javax.inject.Named;
-import javax.inject.Provider;
import dagger.Lazy;
import dagger.Module;
@@ -187,14 +186,14 @@
DozeScrimController dozeScrimController,
VolumeComponent volumeComponent,
CommandQueue commandQueue,
- Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
+ StatusBarComponent.Factory statusBarComponentFactory,
PluginManager pluginManager,
Optional<LegacySplitScreen> splitScreenOptional,
LightsOutNotifController lightsOutNotifController,
StatusBarNotificationActivityStarter.Builder
statusBarNotificationActivityStarterBuilder,
ShadeController shadeController,
- SuperStatusBarViewFactory superStatusBarViewFactory,
+ StatusBarWindowView statusBarWindowView,
StatusBarKeyguardViewManager statusBarKeyguardViewManager,
ViewMediatorCallback viewMediatorCallback,
InitController initController,
@@ -281,13 +280,13 @@
dozeScrimController,
volumeComponent,
commandQueue,
- statusBarComponentBuilder,
+ statusBarComponentFactory,
pluginManager,
splitScreenOptional,
lightsOutNotifController,
statusBarNotificationActivityStarterBuilder,
shadeController,
- superStatusBarViewFactory,
+ statusBarWindowView,
statusBarKeyguardViewManager,
viewMediatorCallback,
initController,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
index 0e83eda..ecf3b86 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java
@@ -17,15 +17,23 @@
package com.android.systemui.statusbar.phone.dagger;
import android.annotation.Nullable;
+import android.content.Context;
+import android.view.LayoutInflater;
import android.view.View;
import com.android.keyguard.LockIconView;
import com.android.systemui.R;
import com.android.systemui.battery.BatteryMeterView;
import com.android.systemui.biometrics.AuthRippleView;
+import com.android.systemui.statusbar.NotificationShelf;
+import com.android.systemui.statusbar.NotificationShelfController;
+import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
+import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.TapAgainView;
+import com.android.systemui.util.InjectionInflationController;
import javax.inject.Named;
@@ -40,6 +48,63 @@
/** */
@Provides
@StatusBarComponent.StatusBarScope
+ public static NotificationShadeWindowView providesNotificationShadeWindowView(
+ InjectionInflationController injectionInflationController,
+ Context context) {
+ NotificationShadeWindowView notificationShadeWindowView = (NotificationShadeWindowView)
+ injectionInflationController.injectable(
+ LayoutInflater.from(context)).inflate(R.layout.super_notification_shade,
+ /* root= */ null);
+ if (notificationShadeWindowView == null) {
+ throw new IllegalStateException(
+ "R.layout.super_notification_shade could not be properly inflated");
+ }
+
+ return notificationShadeWindowView;
+ }
+
+ /** */
+ @Provides
+ @StatusBarComponent.StatusBarScope
+ public static NotificationStackScrollLayout providesNotificationStackScrollLayout(
+ NotificationStackScrollLayoutController notificationStackScrollLayoutController) {
+ return notificationStackScrollLayoutController.getView();
+ }
+
+ /** */
+ @Provides
+ @StatusBarComponent.StatusBarScope
+ public static NotificationShelf providesNotificationShelf(LayoutInflater layoutInflater,
+ NotificationStackScrollLayout notificationStackScrollLayout) {
+ NotificationShelf view = (NotificationShelf) layoutInflater.inflate(
+ R.layout.status_bar_notification_shelf, notificationStackScrollLayout, false);
+
+ if (view == null) {
+ throw new IllegalStateException(
+ "R.layout.status_bar_notification_shelf could not be properly inflated");
+ }
+ return view;
+ }
+
+ /** */
+ @Provides
+ @StatusBarComponent.StatusBarScope
+ public static NotificationShelfController providesStatusBarWindowView(
+ NotificationShelfComponent.Builder notificationShelfComponentBuilder,
+ NotificationShelf notificationShelf) {
+ NotificationShelfComponent component = notificationShelfComponentBuilder
+ .notificationShelf(notificationShelf)
+ .build();
+ NotificationShelfController notificationShelfController =
+ component.getNotificationShelfController();
+ notificationShelfController.init();
+
+ return notificationShelfController;
+ }
+
+ /** */
+ @Provides
+ @StatusBarComponent.StatusBarScope
public static NotificationPanelView getNotificationPanelView(
NotificationShadeWindowView notificationShadeWindowView) {
return notificationShadeWindowView.getNotificationPanelView();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
index 3a05ec7..e679c4c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ConfigurationController.java
@@ -37,6 +37,7 @@
default void onConfigChanged(Configuration newConfig) {}
default void onDensityOrFontScaleChanged() {}
default void onSmallestScreenWidthChanged() {}
+ default void onMaxBoundsChanged() {}
default void onOverlayChanged() {}
default void onUiModeChanged() {}
default void onThemeChanged() {}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
index 65e691f..3bfc2a6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java
@@ -71,6 +71,7 @@
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.demomode.DemoMode;
import com.android.systemui.demomode.DemoModeController;
+import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.qs.tiles.dialog.InternetDialogFactory;
import com.android.systemui.qs.tiles.dialog.InternetDialogUtil;
@@ -129,6 +130,7 @@
private Config mConfig;
private final CarrierConfigTracker mCarrierConfigTracker;
private final FeatureFlags mFeatureFlags;
+ private final DumpManager mDumpManager;
private TelephonyCallback.ActiveDataSubscriptionIdListener mPhoneStateListener;
private int mActiveMobileDataSubscription = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -225,7 +227,8 @@
CarrierConfigTracker carrierConfigTracker,
@Main Handler handler,
InternetDialogFactory internetDialogFactory,
- FeatureFlags featureFlags) {
+ FeatureFlags featureFlags,
+ DumpManager dumpManager) {
this(context, connectivityManager,
telephonyManager,
telephonyListenerManager,
@@ -243,7 +246,8 @@
broadcastDispatcher,
demoModeController,
carrierConfigTracker,
- featureFlags);
+ featureFlags,
+ dumpManager);
mReceiverHandler.post(mRegisterListeners);
mMainHandler = handler;
mInternetDialogFactory = internetDialogFactory;
@@ -265,7 +269,8 @@
BroadcastDispatcher broadcastDispatcher,
DemoModeController demoModeController,
CarrierConfigTracker carrierConfigTracker,
- FeatureFlags featureFlags
+ FeatureFlags featureFlags,
+ DumpManager dumpManager
) {
mContext = context;
mTelephonyListenerManager = telephonyListenerManager;
@@ -284,6 +289,7 @@
mDemoModeController = demoModeController;
mCarrierConfigTracker = carrierConfigTracker;
mFeatureFlags = featureFlags;
+ mDumpManager = dumpManager;
// telephony
mPhone = telephonyManager;
@@ -434,6 +440,8 @@
mDemoModeController.addCallback(this);
mProviderModelBehavior = mFeatureFlags.isCombinedStatusBarSignalIconsEnabled();
mProviderModelSetting = mFeatureFlags.isProviderModelSettingEnabled();
+
+ mDumpManager.registerDumpable(TAG, this);
}
private final Runnable mClearForceValidated = () -> {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/idle/IdleHostViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/idle/IdleHostViewControllerTest.java
index 664072f..a685e20 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/idle/IdleHostViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/idle/IdleHostViewControllerTest.java
@@ -42,6 +42,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
+import com.android.systemui.shared.system.InputChannelCompat;
import com.android.systemui.shared.system.InputMonitorCompat;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.concurrency.DelayableExecutor;
@@ -76,6 +77,7 @@
@Mock private Sensor mSensor;
@Mock private DreamHelper mDreamHelper;
@Mock private InputMonitorCompat mInputMonitor;
+ @Mock private InputChannelCompat.InputEventReceiver mInputEventReceiver;
private final long mTimestamp = Instant.now().toEpochMilli();
private KeyguardStateController.Callback mKeyguardStateCallback;
@@ -91,6 +93,7 @@
when(mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT)).thenReturn(mSensor);
when(mInputMonitorFactory.getInputMonitor("IdleHostViewController"))
.thenReturn(mInputMonitor);
+ when(mInputMonitor.getInputReceiver(any(), any(), any())).thenReturn(mInputEventReceiver);
mController = new IdleHostViewController(mContext,
mBroadcastDispatcher, mPowerManager, mSensorManager, mIdleHostView,
@@ -231,4 +234,21 @@
// Verifies it goes to sleep.
verify(mPowerManager).goToSleep(anyLong(), anyInt(), anyInt());
}
+
+ @Test
+ public void testInputEventReceiverLifecycle() {
+ // Keyguard showing.
+ when(mKeyguardStateController.isShowing()).thenReturn(true);
+ mKeyguardStateCallback.onKeyguardShowingChanged();
+
+ // Should register input event receiver.
+ verify(mInputMonitor).getInputReceiver(any(), any(), any());
+
+ // Keyguard dismissed.
+ when(mKeyguardStateController.isShowing()).thenReturn(false);
+ mKeyguardStateCallback.onKeyguardShowingChanged();
+
+ // Should dispose input event receiver.
+ verify(mInputEventReceiver).dispose();
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt
index 912bea2f..59948d3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QuickQSPanelControllerTest.kt
@@ -16,6 +16,7 @@
package com.android.systemui.qs
+import android.content.res.Configuration
import android.test.suitebuilder.annotation.SmallTest
import android.testing.AndroidTestingRunner
import com.android.internal.logging.MetricsLogger
@@ -27,12 +28,13 @@
import com.android.systemui.plugins.qs.QSTileView
import com.android.systemui.qs.customize.QSCustomizerController
import com.android.systemui.qs.logging.QSLogger
-import com.android.systemui.flags.FeatureFlags
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import org.mockito.ArgumentCaptor
import org.mockito.ArgumentMatchers.anyBoolean
+import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito.`when`
import org.mockito.Mockito.any
@@ -65,11 +67,11 @@
@Mock
private lateinit var tileView: QSTileView
@Mock
- private lateinit var featureFlags: FeatureFlags
- @Mock
private lateinit var quickQsBrightnessController: QuickQSBrightnessController
@Mock
private lateinit var footerActionsController: FooterActionsController
+ @Captor
+ private lateinit var captor: ArgumentCaptor<QSPanel.OnConfigurationChangedListener>
private lateinit var controller: QuickQSPanelController
@@ -78,6 +80,7 @@
MockitoAnnotations.initMocks(this)
`when`(quickQSPanel.tileLayout).thenReturn(tileLayout)
+ `when`(quickQSPanel.isAttachedToWindow).thenReturn(true)
`when`(quickQSPanel.dumpableTag).thenReturn("")
`when`(quickQSPanel.resources).thenReturn(mContext.resources)
`when`(qsTileHost.createTileView(any(), any(), anyBoolean())).thenReturn(tileView)
@@ -123,4 +126,16 @@
verify(quickQSPanel, times(limit)).addTile(any())
}
+
+ @Test
+ fun testBrightnessAndFooterVisibilityRefreshedWhenConfigurationChanged() {
+ // times(2) because both controller and base controller are registering their listeners
+ verify(quickQSPanel, times(2)).addOnConfigurationChangedListener(captor.capture())
+
+ captor.allValues.forEach { it.onConfigurationChange(Configuration.EMPTY) }
+
+ verify(quickQsBrightnessController).refreshVisibility(anyBoolean())
+ // times(2) because footer visibility is also refreshed on controller init
+ verify(footerActionsController, times(2)).refreshVisibility(anyBoolean())
+ }
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
index 690b841..f34f21b 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithmTest.java
@@ -31,42 +31,31 @@
@SmallTest
@RunWith(AndroidTestingRunner.class)
public class KeyguardClockPositionAlgorithmTest extends SysuiTestCase {
-
private static final int SCREEN_HEIGHT = 2000;
private static final int EMPTY_MARGIN = 0;
private static final int EMPTY_HEIGHT = 0;
private static final float ZERO_DRAG = 0.f;
private static final float OPAQUE = 1.f;
private static final float TRANSPARENT = 0.f;
- private static final boolean HAS_CUSTOM_CLOCK = false;
- private static final boolean HAS_VISIBLE_NOTIFS = false;
-
private KeyguardClockPositionAlgorithm mClockPositionAlgorithm;
private KeyguardClockPositionAlgorithm.Result mClockPosition;
- private int mNotificationStackHeight;
private float mPanelExpansion;
private int mKeyguardStatusHeight;
private float mDark;
- private boolean mHasCustomClock;
- private boolean mHasVisibleNotifs;
private float mQsExpansion;
- private int mCutoutTopInset = 0; // in pixels
+ private int mCutoutTopInsetPx = 0;
private boolean mIsSplitShade = false;
@Before
public void setUp() {
mClockPositionAlgorithm = new KeyguardClockPositionAlgorithm();
mClockPosition = new KeyguardClockPositionAlgorithm.Result();
-
- mHasCustomClock = HAS_CUSTOM_CLOCK;
- mHasVisibleNotifs = HAS_VISIBLE_NOTIFS;
}
@Test
public void clockPositionTopOfScreenOnAOD() {
- // GIVEN on AOD and both stack scroll and clock have 0 height
+ // GIVEN on AOD and clock has 0 height
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the clock position algorithm is run
positionClock();
@@ -79,11 +68,10 @@
@Test
public void clockPositionBelowCutout() {
- // GIVEN on AOD and both stack scroll and clock have 0 height
+ // GIVEN on AOD and clock has 0 height
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
- mCutoutTopInset = 300;
+ mCutoutTopInsetPx = 300;
// WHEN the clock position algorithm is run
positionClock();
// THEN the clock Y position is below the cutout
@@ -97,7 +85,6 @@
public void clockPositionAdjustsForKeyguardStatusOnAOD() {
// GIVEN on AOD with a clock of height 100
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 100;
// WHEN the clock position algorithm is run
positionClock();
@@ -112,7 +99,6 @@
public void clockPositionLargeClockOnAOD() {
// GIVEN on AOD with a full screen clock
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the clock position algorithm is run
positionClock();
@@ -125,9 +111,8 @@
@Test
public void clockPositionTopOfScreenOnLockScreen() {
- // GIVEN on lock screen with stack scroll and clock of 0 height
+ // GIVEN on lock screen with clock of 0 height
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the clock position algorithm is run
positionClock();
@@ -138,24 +123,9 @@
}
@Test
- public void clockPositionWithStackScrollExpandOnLockScreen() {
- // GIVEN on lock screen with stack scroll of height 500
- givenLockScreen();
- mNotificationStackHeight = 500;
- mKeyguardStatusHeight = EMPTY_HEIGHT;
- // WHEN the clock position algorithm is run
- positionClock();
- // THEN the clock Y position stays to the top
- assertThat(mClockPosition.clockY).isEqualTo(0);
- // AND the clock is positioned on the left.
- assertThat(mClockPosition.clockX).isEqualTo(0);
- }
-
- @Test
public void clockPositionWithPartialDragOnLockScreen() {
// GIVEN dragging up on lock screen
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.5f;
// WHEN the clock position algorithm is run
@@ -171,7 +141,6 @@
public void clockPositionWithFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run
@@ -184,7 +153,6 @@
public void largeClockOnLockScreenIsTransparent() {
// GIVEN on lock screen with a full screen clock
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the clock position algorithm is run
positionClock();
@@ -194,9 +162,8 @@
@Test
public void notifPositionTopOfScreenOnAOD() {
- // GIVEN on AOD and both stack scroll and clock have 0 height
+ // GIVEN on AOD and clock has 0 height
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the position algorithm is run
positionClock();
@@ -208,7 +175,6 @@
public void notifPositionIndependentOfKeyguardStatusHeightOnAOD() {
// GIVEN on AOD and clock has a nonzero height
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 100;
// WHEN the position algorithm is run
positionClock();
@@ -220,7 +186,6 @@
public void notifPositionWithLargeClockOnAOD() {
// GIVEN on AOD and clock has a nonzero height
givenAOD();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the position algorithm is run
positionClock();
@@ -230,9 +195,8 @@
@Test
public void notifPositionMiddleOfScreenOnLockScreen() {
- // GIVEN on lock screen and both stack scroll and clock have 0 height
+ // GIVEN on lock screen and clock has 0 height
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
// WHEN the position algorithm is run
positionClock();
@@ -241,47 +205,20 @@
}
@Test
- public void notifPositionAdjustsForStackHeightOnLockScreen() {
- // GIVEN on lock screen and stack scroller has a nonzero height
- givenLockScreen();
- mNotificationStackHeight = 500;
- mKeyguardStatusHeight = EMPTY_HEIGHT;
- // WHEN the position algorithm is run
- positionClock();
- // THEN the notif padding adjusts for keyguard status height
- assertThat(mClockPosition.stackScrollerPadding).isEqualTo(0);
- }
-
- @Test
public void notifPositionAdjustsForClockHeightOnLockScreen() {
// GIVEN on lock screen and stack scroller has a nonzero height
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = 200;
// WHEN the position algorithm is run
positionClock();
- // THEN the notif padding adjusts for both clock and notif stack.
- assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
- }
-
- @Test
- public void notifPositionAdjustsForStackHeightAndClockHeightOnLockScreen() {
- // GIVEN on lock screen and stack scroller has a nonzero height
- givenLockScreen();
- mNotificationStackHeight = 500;
- mKeyguardStatusHeight = 200;
- // WHEN the position algorithm is run
- positionClock();
- // THEN the notifs are placed below the statusview
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(200);
}
@Test
public void notifPositionAlignedWithClockInSplitShadeMode() {
- // GIVEN on lock screen and split shade mode
givenLockScreen();
mIsSplitShade = true;
- mHasCustomClock = true;
+ mKeyguardStatusHeight = 200;
// WHEN the position algorithm is run
positionClock();
// THEN the notif padding DOESN'T adjust for keyguard status height.
@@ -292,7 +229,6 @@
public void notifPositionWithLargeClockOnLockScreen() {
// GIVEN on lock screen and clock has a nonzero height
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT;
// WHEN the position algorithm is run
positionClock();
@@ -304,7 +240,6 @@
public void notifPositionWithFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = EMPTY_HEIGHT;
mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run
@@ -317,19 +252,17 @@
public void notifPositionWithLargeClockFullDragOnLockScreen() {
// GIVEN the lock screen is dragged up and a full screen clock
givenLockScreen();
- mNotificationStackHeight = EMPTY_HEIGHT;
mKeyguardStatusHeight = SCREEN_HEIGHT;
mPanelExpansion = 0.f;
// WHEN the clock position algorithm is run
positionClock();
- // THEN the notif padding is zero.
assertThat(mClockPosition.stackScrollerPadding).isEqualTo(
(int) (mKeyguardStatusHeight * .667f));
}
@Test
public void clockHiddenWhenQsIsExpanded() {
- // GIVEN on the lock screen with a custom clock and visible notifications
+ // GIVEN on the lock screen with visible notifications
givenLockScreen();
mQsExpansion = 1;
// WHEN the clock position algorithm is run
@@ -349,12 +282,11 @@
}
private void positionClock() {
- mClockPositionAlgorithm.setup(EMPTY_MARGIN, SCREEN_HEIGHT, mNotificationStackHeight,
- mPanelExpansion, SCREEN_HEIGHT, mKeyguardStatusHeight,
+ mClockPositionAlgorithm.setup(EMPTY_MARGIN, mPanelExpansion, mKeyguardStatusHeight,
0 /* userSwitchHeight */, 0 /* userSwitchPreferredY */,
- mHasCustomClock, mHasVisibleNotifs, mDark, ZERO_DRAG, false /* bypassEnabled */,
+ mDark, ZERO_DRAG, false /* bypassEnabled */,
0 /* unlockedStackScrollerPadding */, mQsExpansion,
- mCutoutTopInset, mIsSplitShade);
+ mCutoutTopInsetPx, mIsSplitShade);
mClockPositionAlgorithm.run(mClockPosition);
}
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
index bcc257d..3d887dd 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationShadeWindowViewTest.java
@@ -46,7 +46,6 @@
import com.android.systemui.statusbar.NotificationShadeDepthController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.PulseExpansionHandler;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -92,7 +91,7 @@
@Mock private NotificationPanelViewController mNotificationPanelViewController;
@Mock private NotificationStackScrollLayout mNotificationStackScrollLayout;
@Mock private NotificationShadeDepthController mNotificationShadeDepthController;
- @Mock private SuperStatusBarViewFactory mStatusBarViewFactory;
+ @Mock private StatusBarWindowView mStatusBarWindowView;
@Mock private NotificationShadeWindowController mNotificationShadeWindowController;
@Mock private NotificationStackScrollLayoutController mNotificationStackScrollLayoutController;
@Mock private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@@ -140,7 +139,7 @@
mNotificationShadeDepthController,
mView,
mNotificationPanelViewController,
- mStatusBarViewFactory,
+ mStatusBarWindowView,
mNotificationStackScrollLayoutController,
mStatusBarKeyguardViewManager);
mController.setupExpandedStatusBar();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt
index 10eb71f..1503af8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarContentInsetsProviderTest.kt
@@ -16,32 +16,54 @@
package com.android.systemui.statusbar.phone
+import android.content.Context
+import android.content.res.Configuration
import android.graphics.Rect
import android.test.suitebuilder.annotation.SmallTest
+import android.view.Display
import android.view.DisplayCutout
-import android.view.WindowMetrics
import com.android.systemui.SysuiTestCase
+import com.android.systemui.dump.DumpManager
+import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.util.leak.RotationUtils
import com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE
import com.android.systemui.util.leak.RotationUtils.ROTATION_NONE
import com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE
import com.android.systemui.util.leak.RotationUtils.ROTATION_UPSIDE_DOWN
import com.android.systemui.util.leak.RotationUtils.Rotation
+import com.google.common.truth.Truth.assertThat
import junit.framework.Assert.assertTrue
import org.junit.Before
import org.junit.Test
+import org.mockito.ArgumentMatchers.any
import org.mockito.Mock
import org.mockito.Mockito.`when`
+import org.mockito.Mockito.mock
import org.mockito.MockitoAnnotations
@SmallTest
class StatusBarContentInsetsProviderTest : SysuiTestCase() {
+
@Mock private lateinit var dc: DisplayCutout
- @Mock private lateinit var windowMetrics: WindowMetrics
+ @Mock private lateinit var contextMock: Context
+ @Mock private lateinit var display: Display
+ private lateinit var configurationController: ConfigurationController
+
+ private val configuration = Configuration()
@Before
fun setup() {
MockitoAnnotations.initMocks(this)
+ `when`(contextMock.display).thenReturn(display)
+
+ context.ensureTestableResources()
+ `when`(contextMock.resources).thenReturn(context.resources)
+ `when`(contextMock.resources.configuration).thenReturn(configuration)
+ `when`(contextMock.createConfigurationContext(any())).thenAnswer {
+ context.createConfigurationContext(it.arguments[0] as Configuration)
+ }
+
+ configurationController = ConfigurationControllerImpl(contextMock)
}
@Test
@@ -55,15 +77,13 @@
val chipWidth = 30
val dotWidth = 10
- `when`(windowMetrics.bounds).thenReturn(screenBounds)
-
var isRtl = false
var targetRotation = ROTATION_NONE
var bounds = calculateInsetsForRotationWithRotatedResources(
currentRotation,
targetRotation,
null,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -92,7 +112,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -127,7 +147,6 @@
val sbHeightLandscape = 60
val currentRotation = ROTATION_NONE
- `when`(windowMetrics.bounds).thenReturn(screenBounds)
`when`(dc.boundingRects).thenReturn(listOf(dcBounds))
// THEN rotations which share a short side should use the greater value between rounded
@@ -142,7 +161,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -159,7 +178,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -178,7 +197,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -196,7 +215,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -219,7 +238,6 @@
val sbHeightLandscape = 60
val currentRotation = ROTATION_NONE
- `when`(windowMetrics.bounds).thenReturn(screenBounds)
`when`(dc.boundingRects).thenReturn(listOf(dcBounds))
// THEN only the landscape/seascape rotations should avoid the cutout area because of the
@@ -234,7 +252,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -251,7 +269,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -268,7 +286,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -285,7 +303,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -303,8 +321,6 @@
val sbHeightPortrait = 100
val sbHeightLandscape = 60
- `when`(windowMetrics.bounds).thenReturn(screenBounds)
-
// THEN content insets should only use rounded corner padding
var targetRotation = ROTATION_NONE
var expectedBounds = Rect(minLeftPadding,
@@ -316,7 +332,7 @@
currentRotation,
targetRotation,
null, /* no cutout */
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -332,7 +348,7 @@
currentRotation,
targetRotation,
null, /* no cutout */
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -348,7 +364,7 @@
currentRotation,
targetRotation,
null, /* no cutout */
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -364,7 +380,7 @@
currentRotation,
targetRotation,
null, /* no cutout */
- windowMetrics,
+ screenBounds,
sbHeightLandscape,
minLeftPadding,
minRightPadding)
@@ -382,7 +398,6 @@
val sbHeightLandscape = 60
val currentRotation = ROTATION_NONE
- `when`(windowMetrics.bounds).thenReturn(screenBounds)
`when`(dc.boundingRects).thenReturn(listOf(dcBounds))
// THEN left should be set to the display cutout width, and right should use the minRight
@@ -396,7 +411,7 @@
currentRotation,
targetRotation,
dc,
- windowMetrics,
+ screenBounds,
sbHeightPortrait,
minLeftPadding,
minRightPadding)
@@ -404,6 +419,67 @@
assertRects(expectedBounds, bounds, currentRotation, targetRotation)
}
+ @Test
+ fun testDisplayChanged_returnsUpdatedInsets() {
+ // GIVEN: get insets on the first display and switch to the second display
+ val provider = StatusBarContentInsetsProvider(contextMock, configurationController,
+ mock(DumpManager::class.java))
+
+ givenDisplay(
+ screenBounds = Rect(0, 0, 1080, 2160),
+ displayUniqueId = "1"
+ )
+ val firstDisplayInsets = provider.getStatusBarContentInsetsForRotation(ROTATION_NONE)
+ givenDisplay(
+ screenBounds = Rect(0, 0, 800, 600),
+ displayUniqueId = "2"
+ )
+ configurationController.onConfigurationChanged(configuration)
+
+ // WHEN: get insets on the second display
+ val secondDisplayInsets = provider.getStatusBarContentInsetsForRotation(ROTATION_NONE)
+
+ // THEN: insets are updated
+ assertThat(firstDisplayInsets).isNotEqualTo(secondDisplayInsets)
+ }
+
+ @Test
+ fun testDisplayChangedAndReturnedBack_returnsTheSameInsets() {
+ // GIVEN: get insets on the first display, switch to the second display,
+ // get insets and switch back
+ val provider = StatusBarContentInsetsProvider(contextMock, configurationController,
+ mock(DumpManager::class.java))
+ givenDisplay(
+ screenBounds = Rect(0, 0, 1080, 2160),
+ displayUniqueId = "1"
+ )
+ val firstDisplayInsetsFirstCall = provider
+ .getStatusBarContentInsetsForRotation(ROTATION_NONE)
+ givenDisplay(
+ screenBounds = Rect(0, 0, 800, 600),
+ displayUniqueId = "2"
+ )
+ configurationController.onConfigurationChanged(configuration)
+ provider.getStatusBarContentInsetsForRotation(ROTATION_NONE)
+ givenDisplay(
+ screenBounds = Rect(0, 0, 1080, 2160),
+ displayUniqueId = "1"
+ )
+ configurationController.onConfigurationChanged(configuration)
+
+ // WHEN: get insets on the first display again
+ val firstDisplayInsetsSecondCall = provider
+ .getStatusBarContentInsetsForRotation(ROTATION_NONE)
+
+ // THEN: insets for the first and second calls for the first display are the same
+ assertThat(firstDisplayInsetsFirstCall).isEqualTo(firstDisplayInsetsSecondCall)
+ }
+
+ private fun givenDisplay(screenBounds: Rect, displayUniqueId: String) {
+ `when`(display.uniqueId).thenReturn(displayUniqueId)
+ configuration.windowConfiguration.maxBounds = screenBounds
+ }
+
private fun assertRects(
expected: Rect,
actual: Rect,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
index 71c61ab..2f7e39b3 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java
@@ -109,7 +109,6 @@
import com.android.systemui.statusbar.PulseExpansionHandler;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.StatusBarStateControllerImpl;
-import com.android.systemui.statusbar.SuperStatusBarViewFactory;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -140,12 +139,12 @@
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
+import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.concurrency.MessageRouterImpl;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
-import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.StartingSurface;
@@ -160,8 +159,6 @@
import java.io.PrintWriter;
import java.util.Optional;
-import javax.inject.Provider;
-
import dagger.Lazy;
@SmallTest
@@ -235,12 +232,11 @@
@Mock private ViewMediatorCallback mKeyguardVieMediatorCallback;
@Mock private VolumeComponent mVolumeComponent;
@Mock private CommandQueue mCommandQueue;
- @Mock private Provider<StatusBarComponent.Builder> mStatusBarComponentBuilderProvider;
- @Mock private StatusBarComponent.Builder mStatusBarComponentBuilder;
+ @Mock private StatusBarComponent.Factory mStatusBarComponentFactory;
@Mock private StatusBarComponent mStatusBarComponent;
@Mock private PluginManager mPluginManager;
@Mock private LegacySplitScreen mLegacySplitScreen;
- @Mock private SuperStatusBarViewFactory mSuperStatusBarViewFactory;
+ @Mock private StatusBarWindowView mStatusBarWindowView;
@Mock private LightsOutNotifController mLightsOutNotifController;
@Mock private ViewMediatorCallback mViewMediatorCallback;
@Mock private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
@@ -341,8 +337,7 @@
when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper);
when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
- when(mStatusBarComponentBuilderProvider.get()).thenReturn(mStatusBarComponentBuilder);
- when(mStatusBarComponentBuilder.build()).thenReturn(mStatusBarComponent);
+ when(mStatusBarComponentFactory.create()).thenReturn(mStatusBarComponent);
when(mStatusBarComponent.getNotificationShadeWindowViewController()).thenReturn(
mNotificationShadeWindowViewController);
@@ -407,13 +402,13 @@
mDozeScrimController,
mVolumeComponent,
mCommandQueue,
- mStatusBarComponentBuilderProvider,
+ mStatusBarComponentFactory,
mPluginManager,
Optional.of(mLegacySplitScreen),
mLightsOutNotifController,
mStatusBarNotificationActivityStarterBuilder,
mShadeController,
- mSuperStatusBarViewFactory,
+ mStatusBarWindowView,
mStatusBarKeyguardViewManager,
mViewMediatorCallback,
mInitController,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
index 21c4a17..c488ee9 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java
@@ -70,6 +70,7 @@
import com.android.systemui.SysuiTestCase;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.demomode.DemoModeController;
+import com.android.systemui.dump.DumpManager;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener;
import com.android.systemui.statusbar.policy.NetworkController.IconState;
@@ -241,7 +242,9 @@
mMockBd,
mDemoModeController,
mCarrierConfigTracker,
- mFeatureFlags);
+ mFeatureFlags,
+ mock(DumpManager.class)
+ );
setupNetworkController();
// Trigger blank callbacks to always get the current state (some tests don't trigger
@@ -309,7 +312,8 @@
mock(AccessPointControllerImpl.class),
mock(DataUsageController.class), mMockSubDefaults,
mock(DeviceProvisionedController.class), mMockBd, mDemoModeController,
- mCarrierConfigTracker, mFeatureFlags);
+ mCarrierConfigTracker, mFeatureFlags,
+ mock(DumpManager.class));
setupNetworkController();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
index bc4c2b6..3433a14 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerDataTest.java
@@ -21,6 +21,7 @@
import com.android.settingslib.mobile.TelephonyIcons;
import com.android.settingslib.net.DataUsageController;
+import com.android.systemui.dump.DumpManager;
import com.android.systemui.util.CarrierConfigTracker;
import org.junit.Test;
@@ -113,7 +114,7 @@
mock(AccessPointControllerImpl.class),
mock(DataUsageController.class), mMockSubDefaults,
mock(DeviceProvisionedController.class), mMockBd, mDemoModeController,
- mock(CarrierConfigTracker.class), mFeatureFlags);
+ mock(CarrierConfigTracker.class), mFeatureFlags, mock(DumpManager.class));
setupNetworkController();
setupDefaultSignal();
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
index 5090b0d..4ff1301 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java
@@ -41,6 +41,7 @@
import com.android.settingslib.mobile.TelephonyIcons;
import com.android.settingslib.net.DataUsageController;
import com.android.systemui.R;
+import com.android.systemui.dump.DumpManager;
import com.android.systemui.util.CarrierConfigTracker;
import org.junit.Test;
@@ -67,7 +68,8 @@
Looper.getMainLooper(), mFakeExecutor, mCallbackHandler,
mock(AccessPointControllerImpl.class), mock(DataUsageController.class),
mMockSubDefaults, mock(DeviceProvisionedController.class), mMockBd,
- mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags);
+ mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags,
+ mock(DumpManager.class));
setupNetworkController();
verifyLastMobileDataIndicators(false, -1, 0);
@@ -87,7 +89,8 @@
Looper.getMainLooper(), mFakeExecutor, mCallbackHandler,
mock(AccessPointControllerImpl.class), mock(DataUsageController.class),
mMockSubDefaults, mock(DeviceProvisionedController.class), mMockBd,
- mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags);
+ mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags,
+ mock(DumpManager.class));
mNetworkController.registerListeners();
// Wait for the main looper to execute the previous command
@@ -155,7 +158,8 @@
Looper.getMainLooper(), mFakeExecutor, mCallbackHandler,
mock(AccessPointControllerImpl.class), mock(DataUsageController.class),
mMockSubDefaults, mock(DeviceProvisionedController.class), mMockBd,
- mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags);
+ mDemoModeController, mock(CarrierConfigTracker.class), mFeatureFlags,
+ mock(DumpManager.class));
setupNetworkController();
// No Subscriptions.
diff --git a/services/core/Android.bp b/services/core/Android.bp
index 689890f..c87a6fa 100644
--- a/services/core/Android.bp
+++ b/services/core/Android.bp
@@ -154,7 +154,7 @@
"android.hardware.configstore-V1.0-java",
"android.hardware.contexthub-V1.0-java",
"android.hardware.rebootescrow-V1-java",
- "android.hardware.soundtrigger-V2.4-java",
+ "android.hardware.soundtrigger-V2.3-java",
"android.hardware.power.stats-V1-java",
"android.hidl.manager-V1.2-java",
"capture_state_listener-aidl-java",
diff --git a/services/core/java/com/android/server/TEST_MAPPING b/services/core/java/com/android/server/TEST_MAPPING
index 9e8b9c6..3288ca8 100644
--- a/services/core/java/com/android/server/TEST_MAPPING
+++ b/services/core/java/com/android/server/TEST_MAPPING
@@ -23,21 +23,6 @@
"file_patterns": ["NotificationManagerService\\.java"]
},
{
- "name": "CtsContentTestCases",
- "options": [
- {
- "include-filter": "android.content.cts.ClipboardManagerTest"
- },
- {
- "include-filter": "android.content.cts.ClipDataTest"
- },
- {
- "include-filter": "android.content.cts.ClipDescriptionTest"
- }
- ],
- "file_patterns": ["ClipboardService\\.java"]
- },
- {
"name": "FrameworksMockingServicesTests",
"options": [
{
@@ -59,6 +44,21 @@
{
"name": "CtsScopedStorageDeviceOnlyTest",
"file_patterns": ["StorageManagerService\\.java"]
+ },
+ {
+ "name": "CtsContentTestCases",
+ "options": [
+ {
+ "include-filter": "android.content.cts.ClipboardManagerTest"
+ },
+ {
+ "include-filter": "android.content.cts.ClipDataTest"
+ },
+ {
+ "include-filter": "android.content.cts.ClipDescriptionTest"
+ }
+ ],
+ "file_patterns": ["ClipboardService\\.java"]
}
]
}
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java
index e94276c..d1e56a0 100644
--- a/services/core/java/com/android/server/am/OomAdjuster.java
+++ b/services/core/java/com/android/server/am/OomAdjuster.java
@@ -72,6 +72,7 @@
import static com.android.server.am.ProcessList.TAG_PROCESS_OBSERVERS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
+import android.annotation.IntDef;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityThread;
@@ -114,6 +115,8 @@
import com.android.server.wm.WindowProcessController;
import java.io.PrintWriter;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -171,6 +174,27 @@
@EnabledSince(targetSdkVersion = android.os.Build.VERSION_CODES.S)
static final long USE_SHORT_FGS_USAGE_INTERACTION_TIME = 183972877L;
+ static final int CACHED_COMPAT_CHANGE_PROCESS_CAPABILITY = 0;
+ static final int CACHED_COMPAT_CHANGE_CAMERA_MICROPHONE_CAPABILITY = 1;
+ static final int CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME = 2;
+
+ @IntDef(prefix = { "CACHED_COMPAT_CHANGE_" }, value = {
+ CACHED_COMPAT_CHANGE_PROCESS_CAPABILITY,
+ CACHED_COMPAT_CHANGE_CAMERA_MICROPHONE_CAPABILITY,
+ CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ static @interface CachedCompatChangeId{}
+
+ /**
+ * Mapping from CACHED_COMPAT_CHANGE_* to the actual compat change id.
+ */
+ static final long[] CACHED_COMPAT_CHANGE_IDS_MAPPING = new long[] {
+ PROCESS_CAPABILITY_CHANGE_ID,
+ CAMERA_MICROPHONE_CAPABILITY_CHANGE_ID,
+ USE_SHORT_FGS_USAGE_INTERACTION_TIME,
+ };
+
/**
* For some direct access we need to power manager.
*/
@@ -396,6 +420,12 @@
return mPlatformCompatCache;
}
+ boolean isChangeEnabled(@CachedCompatChangeId int cachedCompatChangeId, ApplicationInfo app,
+ boolean defaultValue) {
+ return getPlatformCompatCache().isChangeEnabled(
+ CACHED_COMPAT_CHANGE_IDS_MAPPING[cachedCompatChangeId], app, defaultValue);
+ }
+
OomAdjuster(ActivityManagerService service, ProcessList processList, ActiveUids activeUids) {
this(service, processList, activeUids, createAdjusterThread());
}
@@ -1962,12 +1992,8 @@
(fgsType & FOREGROUND_SERVICE_TYPE_LOCATION)
!= 0 ? PROCESS_CAPABILITY_FOREGROUND_LOCATION : 0;
- boolean enabled = false;
- try {
- enabled = getPlatformCompatCache().isChangeEnabled(
- CAMERA_MICROPHONE_CAPABILITY_CHANGE_ID, s.appInfo);
- } catch (RemoteException e) {
- }
+ final boolean enabled = state.getCachedCompatChange(
+ CACHED_COMPAT_CHANGE_CAMERA_MICROPHONE_CAPABILITY);
if (enabled) {
capabilityFromFGS |=
(fgsType & FOREGROUND_SERVICE_TYPE_CAMERA)
@@ -2189,12 +2215,8 @@
// to client's state.
clientProcState = PROCESS_STATE_BOUND_TOP;
state.bumpAllowStartFgsState(PROCESS_STATE_BOUND_TOP);
- boolean enabled = false;
- try {
- enabled = getPlatformCompatCache().isChangeEnabled(
- PROCESS_CAPABILITY_CHANGE_ID, client.info);
- } catch (RemoteException e) {
- }
+ final boolean enabled = cstate.getCachedCompatChange(
+ CACHED_COMPAT_CHANGE_PROCESS_CAPABILITY);
if (enabled) {
if (cr.hasFlag(Context.BIND_INCLUDE_CAPABILITIES)) {
// TOP process passes all capabilities to the service.
@@ -2845,8 +2867,8 @@
state.setProcStateChanged(true);
}
} else if (state.hasReportedInteraction()) {
- final boolean fgsInteractionChangeEnabled = getPlatformCompatCache().isChangeEnabled(
- USE_SHORT_FGS_USAGE_INTERACTION_TIME, app.info, false);
+ final boolean fgsInteractionChangeEnabled = state.getCachedCompatChange(
+ CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME);
final long interactionThreshold = fgsInteractionChangeEnabled
? mConstants.USAGE_STATS_INTERACTION_INTERVAL_POST_S
: mConstants.USAGE_STATS_INTERACTION_INTERVAL_PRE_S;
@@ -2856,8 +2878,8 @@
maybeUpdateUsageStatsLSP(app, nowElapsed);
}
} else {
- final boolean fgsInteractionChangeEnabled = getPlatformCompatCache().isChangeEnabled(
- USE_SHORT_FGS_USAGE_INTERACTION_TIME, app.info, false);
+ final boolean fgsInteractionChangeEnabled = state.getCachedCompatChange(
+ CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME);
final long interactionThreshold = fgsInteractionChangeEnabled
? mConstants.SERVICE_USAGE_INTERACTION_TIME_POST_S
: mConstants.SERVICE_USAGE_INTERACTION_TIME_PRE_S;
@@ -2976,8 +2998,8 @@
if (mService.mUsageStatsService == null) {
return;
}
- final boolean fgsInteractionChangeEnabled = getPlatformCompatCache().isChangeEnabled(
- USE_SHORT_FGS_USAGE_INTERACTION_TIME, app.info, false);
+ final boolean fgsInteractionChangeEnabled = state.getCachedCompatChange(
+ CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME);
boolean isInteraction;
// To avoid some abuse patterns, we are going to be careful about what we consider
// to be an app interaction. Being the top activity doesn't count while the display
diff --git a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
index 8d3e442..a32fe02 100644
--- a/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
+++ b/services/core/java/com/android/server/am/ProcessErrorStateRecord.java
@@ -281,7 +281,8 @@
EventLog.writeEvent(EventLogTags.AM_ANR, mApp.userId, pid, mApp.processName,
mApp.info.flags, annotation);
- if (mService.mTraceErrorLogger.isAddErrorIdEnabled()) {
+ if (mService.mTraceErrorLogger != null
+ && mService.mTraceErrorLogger.isAddErrorIdEnabled()) {
errorId = mService.mTraceErrorLogger.generateErrorId();
mService.mTraceErrorLogger.addErrorIdToTrace(mApp.processName, errorId);
} else {
@@ -427,7 +428,7 @@
float loadingProgress = 1;
IncrementalMetrics incrementalMetrics = null;
final PackageManagerInternal packageManagerInternal = mService.getPackageManagerInternal();
- if (mApp.info != null && mApp.info.packageName != null) {
+ if (mApp.info != null && mApp.info.packageName != null && packageManagerInternal != null) {
IncrementalStatesInfo incrementalStatesInfo =
packageManagerInternal.getIncrementalStatesInfo(
mApp.info.packageName, mApp.uid, mApp.userId);
diff --git a/services/core/java/com/android/server/am/ProcessStateRecord.java b/services/core/java/com/android/server/am/ProcessStateRecord.java
index 46144f5..25a4a94 100644
--- a/services/core/java/com/android/server/am/ProcessStateRecord.java
+++ b/services/core/java/com/android/server/am/ProcessStateRecord.java
@@ -21,6 +21,7 @@
import static android.app.ActivityManager.PROCESS_STATE_NONEXISTENT;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_OOM_ADJ;
+import static com.android.server.am.OomAdjuster.CachedCompatChangeId;
import static com.android.server.am.ProcessRecord.TAG;
import android.annotation.ElapsedRealtimeLong;
@@ -422,6 +423,16 @@
@GuardedBy("mService")
private int mCachedIsReceivingBroadcast = VALUE_INVALID;
+ /**
+ * Cache the return value of PlatformCompat.isChangeEnabled().
+ */
+ @GuardedBy("mService")
+ private int[] mCachedCompatChanges = new int[] {
+ VALUE_INVALID, // CACHED_COMPAT_CHANGE_PROCESS_CAPABILITY
+ VALUE_INVALID, // CACHED_COMPAT_CHANGE_CAMERA_MICROPHONE_CAPABILITY
+ VALUE_INVALID, // CACHED_COMPAT_CHANGE_USE_SHORT_FGS_USAGE_INTERACTION_TIME
+ };
+
@GuardedBy("mService")
private int mCachedAdj = ProcessList.INVALID_ADJ;
@GuardedBy("mService")
@@ -1054,6 +1065,16 @@
}
@GuardedBy("mService")
+ boolean getCachedCompatChange(@CachedCompatChangeId int cachedCompatChangeId) {
+ if (mCachedCompatChanges[cachedCompatChangeId] == VALUE_INVALID) {
+ mCachedCompatChanges[cachedCompatChangeId] = mService.mOomAdjuster
+ .isChangeEnabled(cachedCompatChangeId, mApp.info, false /* default */)
+ ? VALUE_TRUE : VALUE_FALSE;
+ }
+ return mCachedCompatChanges[cachedCompatChangeId] == VALUE_TRUE;
+ }
+
+ @GuardedBy("mService")
void computeOomAdjFromActivitiesIfNecessary(OomAdjuster.ComputeOomAdjWindowCallback callback,
int adj, boolean foregroundActivities, boolean hasVisibleActivities, int procState,
int schedGroup, int appUid, int logUid, int processCurTop) {
@@ -1133,6 +1154,9 @@
mCurSchedGroup = mSetSchedGroup = ProcessList.SCHED_GROUP_BACKGROUND;
mCurProcState = mCurRawProcState = mSetProcState = mAllowStartFgsState =
PROCESS_STATE_NONEXISTENT;
+ for (int i = 0; i < mCachedCompatChanges.length; i++) {
+ mCachedCompatChanges[i] = VALUE_INVALID;
+ }
}
@GuardedBy("mService")
diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java
index bd7baab..764fd09 100644
--- a/services/core/java/com/android/server/audio/AudioService.java
+++ b/services/core/java/com/android/server/audio/AudioService.java
@@ -94,13 +94,11 @@
import android.media.IPlaybackConfigDispatcher;
import android.media.IRecordingConfigDispatcher;
import android.media.IRingtonePlayer;
-import android.media.ISpatializerCallback;
import android.media.IStrategyPreferredDevicesDispatcher;
import android.media.IVolumeController;
import android.media.MediaMetrics;
import android.media.MediaRecorder.AudioSource;
import android.media.PlayerBase;
-import android.media.Spatializer;
import android.media.VolumePolicy;
import android.media.audiofx.AudioEffect;
import android.media.audiopolicy.AudioMix;
@@ -8205,82 +8203,6 @@
}
//==========================================================================================
- private final SpatializerHelper mSpatializerHelper = new SpatializerHelper();
-
- /** @see AudioManager#getSpatializerImmersiveAudioLevel() */
- public int getSpatializerImmersiveAudioLevel() {
- return Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;
- }
-
- /** @see Spatializer#isEnabled() */
- public boolean isSpatializerEnabled() {
- return false;
- }
-
- /** @see Spatializer#canBeSpatialized() */
- public boolean canBeSpatialized(
- @NonNull AudioAttributes attributes, @NonNull AudioFormat format) {
- Objects.requireNonNull(attributes);
- Objects.requireNonNull(format);
- return mSpatializerHelper.canBeSpatialized(attributes, format);
- }
-
- /** @see Spatializer.SpatializerInfoDispatcherStub */
- public void registerSpatializerCallback(
- @NonNull ISpatializerCallback dispatcher) {
- Objects.requireNonNull(dispatcher);
- mSpatializerHelper.registerStateCallback(dispatcher);
- }
-
- /** @see Spatializer.SpatializerInfoDispatcherStub */
- public void unregisterSpatializerCallback(
- @NonNull ISpatializerCallback dispatcher) {
- Objects.requireNonNull(dispatcher);
- mSpatializerHelper.unregisterStateCallback(dispatcher);
- }
-
- /** @see Spatializer#getSpatializerCompatibleAudioDevices() */
- public @NonNull List<AudioDeviceAttributes> getSpatializerCompatibleAudioDevices() {
- enforceModifyAudioRoutingPermission();
- return mSpatializerHelper.getCompatibleAudioDevices();
- }
-
- /** @see Spatializer#addSpatializerCompatibleAudioDevice(AudioDeviceAttributes) */
- public void addSpatializerCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- enforceModifyAudioRoutingPermission();
- Objects.requireNonNull(ada);
- mSpatializerHelper.addCompatibleAudioDevice(ada);
- }
-
- /** @see Spatializer#removeSpatializerCompatibleAudioDevice(AudioDeviceAttributes) */
- public void removeSpatializerCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- enforceModifyAudioRoutingPermission();
- Objects.requireNonNull(ada);
- mSpatializerHelper.removeCompatibleAudioDevice(ada);
- }
-
- /** @see AudioManager#setSpatializerFeatureEnabled(boolean) */
- public void setSpatializerFeatureEnabled(boolean enabled) {
- if (mContext.checkCallingOrSelfPermission(
- android.Manifest.permission.MODIFY_DEFAULT_AUDIO_EFFECTS)
- != PackageManager.PERMISSION_GRANTED) {
- throw new SecurityException("Missing MODIFY_DEFAULT_AUDIO_EFFECTS permission");
- }
- mSpatializerHelper.setEnabled(enabled);
- }
-
- /** @see Spatializer#setEnabledForDevice(boolean, AudioDeviceAttributes)
- * @see Spatializer#setEnabled(boolean)
- */
- public void setSpatializerEnabledForDevice(boolean enabled,
- @NonNull AudioDeviceAttributes ada) {
- enforceModifyAudioRoutingPermission();
- Objects.requireNonNull(ada);
- mSpatializerHelper.setEnabledForDevice(enabled, ada);
- }
-
-
- //==========================================================================================
private boolean readCameraSoundForced() {
return SystemProperties.getBoolean("audio.camerasound.force", false) ||
mContext.getResources().getBoolean(
diff --git a/services/core/java/com/android/server/audio/SpatializerHelper.java b/services/core/java/com/android/server/audio/SpatializerHelper.java
deleted file mode 100644
index 1b68f84..0000000
--- a/services/core/java/com/android/server/audio/SpatializerHelper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.audio;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.media.AudioAttributes;
-import android.media.AudioDeviceAttributes;
-import android.media.AudioFormat;
-import android.media.ISpatializerCallback;
-import android.os.RemoteCallbackList;
-import android.os.RemoteException;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A helper class to manage Spatializer related functionality
- */
-public class SpatializerHelper {
-
- private static final String TAG = "AS.NotificationHelper";
-
- //---------------------------------------------------------------
- // audio device compatibility / enabled
-
- private final ArrayList<AudioDeviceAttributes> mCompatibleAudioDevices = new ArrayList<>(0);
- private final ArrayList<AudioDeviceAttributes> mEnabledAudioDevices = new ArrayList<>(0);
-
- /**
- * @return a shallow copy of the list of compatible audio devices
- */
- synchronized @NonNull List<AudioDeviceAttributes> getCompatibleAudioDevices() {
- return (List<AudioDeviceAttributes>) mCompatibleAudioDevices.clone();
- }
-
- synchronized void addCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- if (!mCompatibleAudioDevices.contains(ada)) {
- mCompatibleAudioDevices.add(ada);
- }
- // by default, adding a compatible device enables it
- if (!mEnabledAudioDevices.contains(ada)) {
- mEnabledAudioDevices.add(ada);
- }
- }
-
- synchronized void removeCompatibleAudioDevice(@NonNull AudioDeviceAttributes ada) {
- mCompatibleAudioDevices.remove(ada);
- mEnabledAudioDevices.remove(ada);
- }
-
- synchronized void setEnabledForDevice(boolean enabled, @NonNull AudioDeviceAttributes ada) {
- if (enabled) {
- if (!mEnabledAudioDevices.contains(ada)) {
- mEnabledAudioDevices.add(ada);
- }
- } else {
- mEnabledAudioDevices.remove(ada);
- }
- }
-
- //------------------------------------------------------
- // enabled state
-
- // global state of feature
- boolean mFeatureEnabled = false;
-
- synchronized void setEnabled(boolean enabled) {
- final boolean oldState = mFeatureEnabled;
- mFeatureEnabled = enabled;
- if (oldState != enabled) {
- dispatchState();
- }
- }
-
- final RemoteCallbackList<ISpatializerCallback> mStateCallbacks =
- new RemoteCallbackList<ISpatializerCallback>();
-
- synchronized void registerStateCallback(
- @NonNull ISpatializerCallback callback) {
- mStateCallbacks.register(callback);
- }
-
- synchronized void unregisterStateCallback(
- @NonNull ISpatializerCallback callback) {
- mStateCallbacks.unregister(callback);
- }
-
- private synchronized void dispatchState() {
- // TODO check enabled state based on available devices
- // (current implementation takes state as-is and dispatches it to listeners
- final int nbCallbacks = mStateCallbacks.beginBroadcast();
- for (int i = 0; i < nbCallbacks; i++) {
- try {
- mStateCallbacks.getBroadcastItem(i)
- .dispatchSpatializerStateChanged(mFeatureEnabled);
- } catch (RemoteException e) {
- Log.e(TAG, "Error in dispatchSpatializerStateChanged", e);
- }
- }
- mStateCallbacks.finishBroadcast();
- }
-
- //------------------------------------------------------
- // virtualization capabilities
- synchronized boolean canBeSpatialized(
- @NonNull AudioAttributes attributes, @NonNull AudioFormat format) {
- // TODO hook up to spatializer effect for query
- return false;
- }
-}
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java b/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
index 444d74d..9437c4f 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecAtomWriter.java
@@ -27,7 +27,8 @@
@VisibleForTesting
public class HdmiCecAtomWriter {
- private static final int FEATURE_ABORT_OPCODE_UNKNOWN = 0x100;
+ @VisibleForTesting
+ protected static final int FEATURE_ABORT_OPCODE_UNKNOWN = 0x100;
private static final int ERROR_CODE_UNKNOWN = -1;
/**
@@ -103,26 +104,32 @@
HdmiCecMessage message) {
MessageReportedSpecialArgs specialArgs = new MessageReportedSpecialArgs();
- int keycode = message.getParams()[0];
- if (keycode >= 0x1E && keycode <= 0x29) {
- specialArgs.mUserControlPressedCommand = HdmiStatsEnums.NUMBER;
- } else {
- specialArgs.mUserControlPressedCommand = keycode + 0x100;
+ if (message.getParams().length > 0) {
+ int keycode = message.getParams()[0];
+ if (keycode >= 0x1E && keycode <= 0x29) {
+ specialArgs.mUserControlPressedCommand = HdmiStatsEnums.NUMBER;
+ } else {
+ specialArgs.mUserControlPressedCommand = keycode + 0x100;
+ }
}
return specialArgs;
}
/**
- * Constructs method for constructing the special arguments for a <Feature Abort> message.
+ * Constructs the special arguments for a <Feature Abort> message.
*
* @param message The HDMI CEC message to log
*/
private MessageReportedSpecialArgs createFeatureAbortSpecialArgs(HdmiCecMessage message) {
MessageReportedSpecialArgs specialArgs = new MessageReportedSpecialArgs();
- specialArgs.mFeatureAbortOpcode = message.getParams()[0] & 0xFF; // Unsigned byte
- specialArgs.mFeatureAbortReason = message.getParams()[1] + 10;
+ if (message.getParams().length > 0) {
+ specialArgs.mFeatureAbortOpcode = message.getParams()[0] & 0xFF; // Unsigned byte
+ if (message.getParams().length > 1) {
+ specialArgs.mFeatureAbortReason = message.getParams()[1] + 10;
+ }
+ }
return specialArgs;
}
@@ -135,8 +142,7 @@
*/
private void messageReportedBase(MessageReportedGenericArgs genericArgs,
MessageReportedSpecialArgs specialArgs) {
- FrameworkStatsLog.write(
- FrameworkStatsLog.HDMI_CEC_MESSAGE_REPORTED,
+ writeHdmiCecMessageReportedAtom(
genericArgs.mUid,
genericArgs.mDirection,
genericArgs.mInitiatorLogicalAddress,
@@ -148,6 +154,26 @@
specialArgs.mFeatureAbortReason);
}
+ /**
+ * Writes a HdmiCecMessageReported atom representing an incoming or outgoing HDMI-CEC message.
+ */
+ @VisibleForTesting
+ protected void writeHdmiCecMessageReportedAtom(int uid, int direction,
+ int initiatorLogicalAddress, int destinationLogicalAddress, int opcode,
+ int sendMessageResult, int userControlPressedCommand, int featureAbortOpcode,
+ int featureAbortReason) {
+ FrameworkStatsLog.write(
+ FrameworkStatsLog.HDMI_CEC_MESSAGE_REPORTED,
+ uid,
+ direction,
+ initiatorLogicalAddress,
+ destinationLogicalAddress,
+ opcode,
+ sendMessageResult,
+ userControlPressedCommand,
+ featureAbortOpcode,
+ featureAbortReason);
+ }
/**
* Writes a HdmiCecActiveSourceChanged atom representing a change in the active source.
diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java
index c905fe0..c553176 100644
--- a/services/core/java/com/android/server/input/InputManagerService.java
+++ b/services/core/java/com/android/server/input/InputManagerService.java
@@ -180,7 +180,7 @@
private static final boolean UNTRUSTED_TOUCHES_TOAST = false;
public static final boolean ENABLE_PER_WINDOW_INPUT_ROTATION =
- SystemProperties.getBoolean("persist.debug.per_window_input_rotation", false);
+ SystemProperties.getBoolean("persist.debug.per_window_input_rotation", true);
// Pointer to native input manager service object.
private final long mPtr;
diff --git a/services/core/java/com/android/server/pm/TEST_MAPPING b/services/core/java/com/android/server/pm/TEST_MAPPING
index cc5187e..95c9191 100644
--- a/services/core/java/com/android/server/pm/TEST_MAPPING
+++ b/services/core/java/com/android/server/pm/TEST_MAPPING
@@ -104,20 +104,6 @@
"file_patterns": ["(/|^)ShortcutService\\.java"]
},
{
- "name": "CtsContentTestCases",
- "options": [
- {
- "exclude-annotation": "androidx.test.filters.FlakyTest"
- },
- {
- "exclude-annotation": "org.junit.Ignore"
- },
- {
- "include-filter": "android.content.pm.cts"
- }
- ]
- },
- {
"name": "GtsContentTestCases",
"options": [
{
@@ -183,6 +169,22 @@
]
}
],
+ "presubmit-large": [
+ {
+ "name": "CtsContentTestCases",
+ "options": [
+ {
+ "exclude-annotation": "androidx.test.filters.FlakyTest"
+ },
+ {
+ "exclude-annotation": "org.junit.Ignore"
+ },
+ {
+ "include-filter": "android.content.pm.cts"
+ }
+ ]
+ }
+ ],
"postsubmit": [
{
"name": "CtsPermissionTestCases",
diff --git a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
index 7a1f775..c638201 100644
--- a/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
+++ b/services/core/java/com/android/server/soundtrigger_middleware/SoundTriggerHw2Compat.java
@@ -60,7 +60,6 @@
private @Nullable android.hardware.soundtrigger.V2_1.ISoundTriggerHw mUnderlying_2_1;
private @Nullable android.hardware.soundtrigger.V2_2.ISoundTriggerHw mUnderlying_2_2;
private @Nullable android.hardware.soundtrigger.V2_3.ISoundTriggerHw mUnderlying_2_3;
- private @Nullable android.hardware.soundtrigger.V2_4.ISoundTriggerHw mUnderlying_2_4;
// HAL <=2.1 requires us to pass a callback argument to startRecognition. We will store the one
// passed on load and then pass it on start. We don't bother storing the callback on newer
@@ -89,13 +88,10 @@
ICaptureStateNotifier notifier) {
SoundTriggerHw2Compat compat = new SoundTriggerHw2Compat(binder, rebootRunnable);
ISoundTriggerHal result = compat;
- // Add max model limiter for versions <2.4.
- if (compat.mUnderlying_2_4 == null) {
- result = new SoundTriggerHalMaxModelLimiter(result,
- compat.mProperties.maxSoundModels);
- }
- // Add concurrent capture handler for versions <2.4 which do not support concurrent capture.
- if (compat.mUnderlying_2_4 == null && !compat.mProperties.concurrentCapture) {
+ // Add max model limiter for versions.
+ result = new SoundTriggerHalMaxModelLimiter(result, compat.mProperties.maxSoundModels);
+ // Add concurrent capture handler for HALs which do not support concurrent capture.
+ if (!compat.mProperties.concurrentCapture) {
result = new SoundTriggerHalConcurrentCaptureHandler(result, notifier);
}
return result;
@@ -113,21 +109,11 @@
// version, so we go down the versions in descending order to find the latest one supported,
// and then simply up-cast it to obtain all the versions that are earlier.
- // Attempt 2.4
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw as2_4 =
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw.asInterface(binder);
- if (as2_4 != null) {
- mUnderlying_2_0 =
- mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = as2_4;
- return;
- }
-
// Attempt 2.3
android.hardware.soundtrigger.V2_3.ISoundTriggerHw as2_3 =
android.hardware.soundtrigger.V2_3.ISoundTriggerHw.asInterface(binder);
if (as2_3 != null) {
mUnderlying_2_0 = mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = as2_3;
- mUnderlying_2_4 = null;
return;
}
@@ -136,7 +122,7 @@
android.hardware.soundtrigger.V2_2.ISoundTriggerHw.asInterface(binder);
if (as2_2 != null) {
mUnderlying_2_0 = mUnderlying_2_1 = mUnderlying_2_2 = as2_2;
- mUnderlying_2_3 = mUnderlying_2_4 = null;
+ mUnderlying_2_3 = null;
return;
}
@@ -145,7 +131,7 @@
android.hardware.soundtrigger.V2_1.ISoundTriggerHw.asInterface(binder);
if (as2_1 != null) {
mUnderlying_2_0 = mUnderlying_2_1 = as2_1;
- mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = null;
+ mUnderlying_2_2 = mUnderlying_2_3 = null;
return;
}
@@ -154,7 +140,7 @@
android.hardware.soundtrigger.V2_0.ISoundTriggerHw.asInterface(binder);
if (as2_0 != null) {
mUnderlying_2_0 = as2_0;
- mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = mUnderlying_2_4 = null;
+ mUnderlying_2_1 = mUnderlying_2_2 = mUnderlying_2_3 = null;
return;
}
@@ -213,16 +199,8 @@
@Override
public void registerCallback(GlobalCallback callback) {
- try {
- try {
- as2_4().registerGlobalCallback(new GlobalCallbackWrapper(callback));
- } catch (NotSupported e) {
- // In versions < 2.4 the events represented by this callback don't exist, we can
- // safely ignore this.
- }
- } catch (RemoteException e) {
- throw e.rethrowAsRuntimeException();
- }
+ // In versions 2.x the events represented by this callback don't exist, we can
+ // safely ignore this.
}
@Override
@@ -232,29 +210,18 @@
try {
AtomicInteger retval = new AtomicInteger(-1);
AtomicInteger handle = new AtomicInteger(0);
-
try {
- as2_4().loadSoundModel_2_4(hidlModel, new ModelCallbackWrapper(callback),
+ as2_1().loadSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
+ 0,
(r, h) -> {
retval.set(r);
handle.set(h);
});
- handleHalStatusAllowBusy(retval.get(), "loadSoundModel_2_4");
- } catch (NotSupported e) {
- // Fall-back to the 2.1 version:
- try {
- as2_1().loadSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
- 0,
- (r, h) -> {
- retval.set(r);
- handle.set(h);
- });
- handleHalStatus(retval.get(), "loadSoundModel_2_1");
- mModelCallbacks.put(handle.get(), callback);
- } catch (NotSupported ee) {
- // Fall-back to the 2.0 version:
- return loadSoundModel_2_0(hidlModel, callback);
- }
+ handleHalStatus(retval.get(), "loadSoundModel_2_1");
+ mModelCallbacks.put(handle.get(), callback);
+ } catch (NotSupported ee) {
+ // Fall-back to the 2.0 version:
+ return loadSoundModel_2_0(hidlModel, callback);
}
return handle.get();
} catch (RemoteException e) {
@@ -270,27 +237,17 @@
AtomicInteger retval = new AtomicInteger(-1);
AtomicInteger handle = new AtomicInteger(0);
try {
- as2_4().loadPhraseSoundModel_2_4(hidlModel, new ModelCallbackWrapper(callback),
+ as2_1().loadPhraseSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
+ 0,
(r, h) -> {
retval.set(r);
handle.set(h);
});
- handleHalStatusAllowBusy(retval.get(), "loadPhraseSoundModel_2_4");
- } catch (NotSupported e) {
- // Fall-back to the 2.1 version:
- try {
- as2_1().loadPhraseSoundModel_2_1(hidlModel, new ModelCallbackWrapper(callback),
- 0,
- (r, h) -> {
- retval.set(r);
- handle.set(h);
- });
- handleHalStatus(retval.get(), "loadPhraseSoundModel_2_1");
- mModelCallbacks.put(handle.get(), callback);
- } catch (NotSupported ee) {
- // Fall-back to the 2.0 version:
- return loadPhraseSoundModel_2_0(hidlModel, callback);
- }
+ handleHalStatus(retval.get(), "loadPhraseSoundModel_2_1");
+ mModelCallbacks.put(handle.get(), callback);
+ } catch (NotSupported ee) {
+ // Fall-back to the 2.0 version:
+ return loadPhraseSoundModel_2_0(hidlModel, callback);
}
return handle.get();
} catch (RemoteException e) {
@@ -328,17 +285,11 @@
ConversionUtil.aidl2hidlRecognitionConfig(config, deviceHandle, ioHandle);
try {
try {
- int retval = as2_4().startRecognition_2_4(modelHandle, hidlConfig);
- handleHalStatusAllowBusy(retval, "startRecognition_2_4");
- } catch (NotSupported e) {
- // Fall-back to the 2.3 version:
- try {
- int retval = as2_3().startRecognition_2_3(modelHandle, hidlConfig);
- handleHalStatus(retval, "startRecognition_2_3");
- } catch (NotSupported ee) {
- // Fall-back to the 2.0 version:
- startRecognition_2_1(modelHandle, hidlConfig);
- }
+ int retval = as2_3().startRecognition_2_3(modelHandle, hidlConfig);
+ handleHalStatus(retval, "startRecognition_2_3");
+ } catch (NotSupported ee) {
+ // Fall-back to the 2.0 version:
+ startRecognition_2_1(modelHandle, hidlConfig);
}
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
@@ -551,14 +502,6 @@
return mUnderlying_2_3;
}
- private @NonNull
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw as2_4() throws NotSupported {
- if (mUnderlying_2_4 == null) {
- throw new NotSupported("Underlying driver version < 2.4");
- }
- return mUnderlying_2_4;
- }
-
/**
* A checked exception representing the requested interface version not being supported.
* At the public interface layer, use {@link #throwAsRecoverableException()} to propagate it to
@@ -580,22 +523,8 @@
}
}
- private static class GlobalCallbackWrapper extends
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback.Stub {
- private final @NonNull GlobalCallback mDelegate;
-
- private GlobalCallbackWrapper(@NonNull GlobalCallback delegate) {
- mDelegate = delegate;
- }
-
- @Override
- public void onResourcesAvailable() {
- mDelegate.onResourcesAvailable();
- }
- }
-
private static class ModelCallbackWrapper extends
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.Stub {
+ android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.Stub {
private final @NonNull ModelCallback mDelegate;
private ModelCallbackWrapper(
@@ -604,11 +533,6 @@
}
@Override
- public void modelUnloaded(int modelHandle) {
- mDelegate.modelUnloaded(modelHandle);
- }
-
- @Override
public void recognitionCallback_2_1(
android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback.RecognitionEvent event,
int cookie) {
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 6aea848..929ac56f 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -40,6 +40,7 @@
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
+import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
@@ -476,6 +477,7 @@
mNextAppTransitionAnimationsSpecsFuture = null;
mDefaultNextAppTransitionAnimationSpec = null;
mAnimationFinishedCallback = null;
+ mOverrideTaskTransition = false;
mNextAppTransitionIsSync = false;
}
@@ -941,7 +943,7 @@
"applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: "
+ "anim=%s transit=%s isEntrance=true Callers=%s",
a, appTransitionOldToString(transit), Debug.getCallers(3));
- } else if (transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE) {
+ } else if (isChangeTransitOld(transit)) {
// In the absence of a specific adapter, we just want to keep everything stationary.
a = new AlphaAnimation(1.f, 1.f);
a.setDuration(WindowChangeAnimationSpec.ANIMATION_DURATION);
@@ -1338,6 +1340,9 @@
case TRANSIT_OLD_TASK_FRAGMENT_CLOSE: {
return "TRANSIT_OLD_TASK_FRAGMENT_CLOSE";
}
+ case TRANSIT_OLD_TASK_FRAGMENT_CHANGE: {
+ return "TRANSIT_OLD_TASK_FRAGMENT_CHANGE";
+ }
default: {
return "<UNKNOWN: " + transition + ">";
}
@@ -1595,7 +1600,8 @@
}
static boolean isChangeTransitOld(@TransitionOldType int transit) {
- return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
+ return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE
+ || transit == TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
}
static boolean isClosingTransitOld(@TransitionOldType int transit) {
diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java
index 6745c69..544cade 100644
--- a/services/core/java/com/android/server/wm/AppTransitionController.java
+++ b/services/core/java/com/android/server/wm/AppTransitionController.java
@@ -39,6 +39,7 @@
import static android.view.WindowManager.TRANSIT_OLD_NONE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
+import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
@@ -204,8 +205,8 @@
mDisplayContent.mOpeningApps);
final @TransitionOldType int transit = getTransitCompatType(
- mDisplayContent.mAppTransition,
- mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
+ mDisplayContent.mAppTransition, mDisplayContent.mOpeningApps,
+ mDisplayContent.mClosingApps, mDisplayContent.mChangingContainers,
mWallpaperControllerLocked.getWallpaperTarget(), getOldWallpaper(),
mDisplayContent.mSkipAppTransitionAnimation);
mDisplayContent.mSkipAppTransitionAnimation = false;
@@ -286,6 +287,7 @@
* @param appTransition {@link AppTransition} for managing app transition state.
* @param openingApps {@link ActivityRecord}s which are becoming visible.
* @param closingApps {@link ActivityRecord}s which are becoming invisible.
+ * @param changingContainers {@link WindowContainer}s which are changed in configuration.
* @param wallpaperTarget If non-null, this is the currently visible window that is associated
* with the wallpaper.
* @param oldWallpaper The currently visible window that is associated with the wallpaper in
@@ -294,8 +296,8 @@
*/
static @TransitionOldType int getTransitCompatType(AppTransition appTransition,
ArraySet<ActivityRecord> openingApps, ArraySet<ActivityRecord> closingApps,
- @Nullable WindowState wallpaperTarget, @Nullable WindowState oldWallpaper,
- boolean skipAppTransitionAnimation) {
+ ArraySet<WindowContainer> changingContainers, @Nullable WindowState wallpaperTarget,
+ @Nullable WindowState oldWallpaper, boolean skipAppTransitionAnimation) {
// Determine if closing and opening app token sets are wallpaper targets, in which case
// special animations are needed.
@@ -328,8 +330,18 @@
// Special transitions
// TODO(new-app-transitions): Revisit if those can be rewritten by using flags.
- if (appTransition.containsTransitRequest(TRANSIT_CHANGE)) {
- return TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
+ if (appTransition.containsTransitRequest(TRANSIT_CHANGE) && !changingContainers.isEmpty()) {
+ @TransitContainerType int changingType =
+ getTransitContainerType(changingContainers.valueAt(0));
+ switch (changingType) {
+ case TYPE_TASK:
+ return TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
+ case TYPE_TASK_FRAGMENT:
+ return TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
+ default:
+ throw new IllegalStateException(
+ "TRANSIT_CHANGE with unrecognized changing type=" + changingType);
+ }
}
if ((flags & TRANSIT_FLAG_APP_CRASHED) != 0) {
return TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index ee075fa..7220a23 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -5747,6 +5747,13 @@
}
mRemoved = true;
+ if (mMirroredSurface != null) {
+ // Do not wait for the mirrored surface to be garbage collected, but clean up
+ // immediately.
+ mWmService.mTransactionFactory.get().remove(mMirroredSurface).apply();
+ mMirroredSurface = null;
+ }
+
// Only update focus/visibility for the last one because there may be many root tasks are
// reparented and the intermediate states are unnecessary.
if (lastReparentedRootTask != null) {
diff --git a/services/core/java/com/android/server/wm/InsetsStateController.java b/services/core/java/com/android/server/wm/InsetsStateController.java
index 2c4adcb..fd16a7d 100644
--- a/services/core/java/com/android/server/wm/InsetsStateController.java
+++ b/services/core/java/com/android/server/wm/InsetsStateController.java
@@ -16,9 +16,9 @@
package com.android.server.wm;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
-import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.InsetsState.ITYPE_CAPTION_BAR;
import static android.view.InsetsState.ITYPE_CLIMATE_BAR;
@@ -137,10 +137,10 @@
return rotatedState;
}
}
- final @WindowingMode int windowingMode = token != null
- ? token.getWindowingMode() : WINDOWING_MODE_UNDEFINED;
final boolean alwaysOnTop = token != null && token.isAlwaysOnTop();
- return getInsetsForTarget(type, windowingMode, alwaysOnTop, mState);
+ // Always use windowing mode fullscreen when get insets for window metrics to make sure it
+ // contains all insets types.
+ return getInsetsForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop, mState);
}
private static @InternalInsetsType
diff --git a/services/core/java/com/android/server/wm/LetterboxConfiguration.java b/services/core/java/com/android/server/wm/LetterboxConfiguration.java
index eb7087c..34b834b 100644
--- a/services/core/java/com/android/server/wm/LetterboxConfiguration.java
+++ b/services/core/java/com/android/server/wm/LetterboxConfiguration.java
@@ -17,6 +17,7 @@
package com.android.server.wm;
import android.annotation.IntDef;
+import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Color;
@@ -63,7 +64,10 @@
private int mLetterboxActivityCornersRadius;
// Color for {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} letterbox background type.
- private Color mLetterboxBackgroundColor;
+ @Nullable private Color mLetterboxBackgroundColorOverride;
+
+ // Color resource id for {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} letterbox background type.
+ @Nullable private Integer mLetterboxBackgroundColorResourceIdOverride;
@LetterboxBackgroundType
private int mLetterboxBackgroundType;
@@ -81,20 +85,18 @@
// side of the screen and 1.0 to the right side.
private float mLetterboxHorizontalPositionMultiplier;
- LetterboxConfiguration(Context context) {
- mContext = context;
- mFixedOrientationLetterboxAspectRatio = context.getResources().getFloat(
+ LetterboxConfiguration(Context systemUiContext) {
+ mContext = systemUiContext;
+ mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat(
R.dimen.config_fixedOrientationLetterboxAspectRatio);
- mLetterboxActivityCornersRadius = context.getResources().getInteger(
+ mLetterboxActivityCornersRadius = mContext.getResources().getInteger(
R.integer.config_letterboxActivityCornersRadius);
- mLetterboxBackgroundColor = Color.valueOf(context.getResources().getColor(
- R.color.config_letterboxBackgroundColor));
- mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(context);
- mLetterboxBackgroundWallpaperBlurRadius = context.getResources().getDimensionPixelSize(
+ mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
+ mLetterboxBackgroundWallpaperBlurRadius = mContext.getResources().getDimensionPixelSize(
R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
- mLetterboxBackgroundWallpaperDarkScrimAlpha = context.getResources().getFloat(
+ mLetterboxBackgroundWallpaperDarkScrimAlpha = mContext.getResources().getFloat(
R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha);
- mLetterboxHorizontalPositionMultiplier = context.getResources().getFloat(
+ mLetterboxHorizontalPositionMultiplier = mContext.getResources().getFloat(
R.dimen.config_letterboxHorizontalPositionMultiplier);
}
@@ -158,12 +160,20 @@
}
/**
- * Gets color of letterbox background which is used when {@link
+ * Gets color of letterbox background which is used when {@link
* #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
* fallback for other backfround types.
*/
Color getLetterboxBackgroundColor() {
- return mLetterboxBackgroundColor;
+ if (mLetterboxBackgroundColorOverride != null) {
+ return mLetterboxBackgroundColorOverride;
+ }
+ int colorId = mLetterboxBackgroundColorResourceIdOverride != null
+ ? mLetterboxBackgroundColorResourceIdOverride
+ : R.color.config_letterboxBackgroundColor;
+ // Query color dynamically because material colors extracted from wallpaper are updated
+ // when wallpaper is changed.
+ return Color.valueOf(mContext.getResources().getColor(colorId));
}
@@ -173,7 +183,16 @@
* fallback for other backfround types.
*/
void setLetterboxBackgroundColor(Color color) {
- mLetterboxBackgroundColor = color;
+ mLetterboxBackgroundColorOverride = color;
+ }
+
+ /**
+ * Sets color ID of letterbox background which is used when {@link
+ * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
+ * fallback for other backfround types.
+ */
+ void setLetterboxBackgroundColorResourceId(int colorId) {
+ mLetterboxBackgroundColorResourceIdOverride = colorId;
}
/**
@@ -181,8 +200,8 @@
* com.android.internal.R.color.config_letterboxBackgroundColor}.
*/
void resetLetterboxBackgroundColor() {
- mLetterboxBackgroundColor = Color.valueOf(mContext.getResources().getColor(
- com.android.internal.R.color.config_letterboxBackgroundColor));
+ mLetterboxBackgroundColorOverride = null;
+ mLetterboxBackgroundColorResourceIdOverride = null;
}
/**
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index 73dda74..567936d 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -2166,16 +2166,6 @@
bounds.offset(horizontalDiff, verticalDiff);
}
- /**
- * Initializes a change transition. See {@link SurfaceFreezer} for more information.
- */
- private void initializeChangeTransition(Rect startBounds) {
- mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
- mDisplayContent.mChangingContainers.add(this);
-
- mSurfaceFreezer.freeze(getPendingTransaction(), startBounds);
- }
-
private boolean shouldStartChangeTransition(int prevWinMode, int newWinMode) {
if (mWmService.mDisableTransitionAnimation
|| !isVisible()
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index 5363c9b..242693b 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -33,6 +33,7 @@
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
import static android.os.UserHandle.USER_NULL;
import static android.view.Display.INVALID_DISPLAY;
+import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_NONE;
@@ -1987,10 +1988,48 @@
@Override
public void onConfigurationChanged(Configuration newParentConfig) {
+ // Task will animate differently.
+ if (mTaskFragmentOrganizer != null) {
+ mTmpPrevBounds.set(getBounds());
+ }
+
super.onConfigurationChanged(newParentConfig);
+
+ if (shouldStartChangeTransition(mTmpPrevBounds)) {
+ initializeChangeTransition(mTmpPrevBounds);
+ }
+
+ if (mTaskFragmentOrganizer != null) {
+ // Update the surface position here instead of in the organizer so that we can make sure
+ // it can be synced with the surface freezer.
+ updateSurfacePosition(getSyncTransaction());
+ }
+
sendTaskFragmentInfoChanged();
}
+ /** Whether we should prepare a transition for this {@link TaskFragment} bounds change. */
+ private boolean shouldStartChangeTransition(Rect startBounds) {
+ if (mWmService.mDisableTransitionAnimation
+ || mDisplayContent == null
+ || mTaskFragmentOrganizer == null
+ || getSurfaceControl() == null
+ || !isVisible()) {
+ return false;
+ }
+
+ return !startBounds.equals(getBounds());
+ }
+
+ /**
+ * Initializes a change transition. See {@link SurfaceFreezer} for more information.
+ */
+ void initializeChangeTransition(Rect startBounds) {
+ mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
+ mDisplayContent.mChangingContainers.add(this);
+ mSurfaceFreezer.freeze(getSyncTransaction(), startBounds);
+ }
+
@Override
void setSurfaceControl(SurfaceControl sc) {
super.setSurfaceControl(sc);
@@ -2061,6 +2100,11 @@
return mTaskFragmentOrganizer;
}
+ @Override
+ boolean isOrganized() {
+ return mTaskFragmentOrganizer != null;
+ }
+
/** Clear {@link #mLastPausedActivity} for all {@link TaskFragment} children */
void clearLastPausedActivity() {
forAllTaskFragments(taskFragment -> taskFragment.mLastPausedActivity = null);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index c7af2e8..b1d1244 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -1218,7 +1218,9 @@
mAssistantOnTopOfDream = context.getResources().getBoolean(
com.android.internal.R.bool.config_assistantOnTopOfDream);
- mLetterboxConfiguration = new LetterboxConfiguration(context);
+ mLetterboxConfiguration = new LetterboxConfiguration(
+ // Using SysUI context to have access to Material colors extracted from Wallpaper.
+ ActivityThread.currentActivityThread().getSystemUiContext());
mInputManager = inputManager; // Must be before createDisplayContentLocked.
mDisplayManagerInternal = LocalServices.getService(DisplayManagerInternal.class);
diff --git a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
index d5965494..1d1cb70 100644
--- a/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
+++ b/services/core/java/com/android/server/wm/WindowManagerShellCommand.java
@@ -24,6 +24,7 @@
import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_SOLID_COLOR;
import static com.android.server.wm.LetterboxConfiguration.LETTERBOX_BACKGROUND_WALLPAPER;
+import android.content.res.Resources.NotFoundException;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
@@ -606,7 +607,7 @@
return -1;
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or aspect ratio should be provided as an argument " + e);
+ "Error: aspect ratio should be provided as an argument " + e);
return -1;
}
synchronized (mInternal.mGlobalLock) {
@@ -625,7 +626,7 @@
return -1;
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or corners radius should be provided as an argument " + e);
+ "Error: corners radius should be provided as an argument " + e);
return -1;
}
synchronized (mInternal.mGlobalLock) {
@@ -653,13 +654,13 @@
break;
default:
getErrPrintWriter().println(
- "Error: 'reset', 'solid_color', 'app_color_background' or "
+ "Error: 'solid_color', 'app_color_background' or "
+ "'wallpaper' should be provided as an argument");
return -1;
}
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset', 'solid_color', 'app_color_background' or "
+ "Error: 'solid_color', 'app_color_background' or "
+ "'wallpaper' should be provided as an argument" + e);
return -1;
}
@@ -669,6 +670,24 @@
return 0;
}
+ private int runSetLetterboxBackgroundColorResource(PrintWriter pw) throws RemoteException {
+ final int colorId;
+ try {
+ String arg = getNextArgRequired();
+ colorId = mInternal.mContext.getResources()
+ .getIdentifier(arg, "color", "com.android.internal");
+ } catch (NotFoundException e) {
+ getErrPrintWriter().println(
+ "Error: color in '@android:color/resource_name' format should be provided as "
+ + "an argument " + e);
+ return -1;
+ }
+ synchronized (mInternal.mGlobalLock) {
+ mLetterboxConfiguration.setLetterboxBackgroundColorResourceId(colorId);
+ }
+ return 0;
+ }
+
private int runSetLetterboxBackgroundColor(PrintWriter pw) throws RemoteException {
final Color color;
try {
@@ -676,7 +695,7 @@
color = Color.valueOf(Color.parseColor(arg));
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or color in #RRGGBB format should be provided as "
+ "Error: color in #RRGGBB format should be provided as "
+ "an argument " + e);
return -1;
}
@@ -697,7 +716,7 @@
return -1;
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or blur radius should be provided as an argument " + e);
+ "Error: blur radius should be provided as an argument " + e);
return -1;
}
synchronized (mInternal.mGlobalLock) {
@@ -717,7 +736,7 @@
return -1;
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or alpha should be provided as an argument " + e);
+ "Error: alpha should be provided as an argument " + e);
return -1;
}
synchronized (mInternal.mGlobalLock) {
@@ -736,7 +755,7 @@
return -1;
} catch (IllegalArgumentException e) {
getErrPrintWriter().println(
- "Error: 'reset' or multiplier should be provided as an argument " + e);
+ "Error: multiplier should be provided as an argument " + e);
return -1;
}
synchronized (mInternal.mGlobalLock) {
@@ -764,6 +783,9 @@
case "--backgroundColor":
runSetLetterboxBackgroundColor(pw);
break;
+ case "--backgroundColorResource":
+ runSetLetterboxBackgroundColorResource(pw);
+ break;
case "--wallpaperBlurRadius":
runSetLetterboxBackgroundWallpaperBlurRadius(pw);
break;
@@ -1031,6 +1053,11 @@
pw.println(" is 'solid-color'. Use (set)get-letterbox-style to check and control");
pw.println(" letterbox background type. See Color#parseColor for allowed color");
pw.println(" formats (#RRGGBB and some colors by name, e.g. magenta or olive).");
+ pw.println(" --backgroundColorResource resource_name");
+ pw.println(" Color resource name of letterbox background which is used when");
+ pw.println(" background type is 'solid-color'. Use (set)get-letterbox-style to");
+ pw.println(" check and control background type. Parameter is a color resource");
+ pw.println(" name, for example, @android:color/system_accent2_50.");
pw.println(" --wallpaperBlurRadius radius");
pw.println(" Blur radius for 'wallpaper' letterbox background. If radius <= 0");
pw.println(" both it and R.dimen.config_letterboxBackgroundWallpaperBlurRadius");
diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java
index 45c47ba..b568774 100644
--- a/services/core/java/com/android/server/wm/WindowOrganizerController.java
+++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java
@@ -56,6 +56,7 @@
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
+import android.util.AndroidRuntimeException;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.Slog;
@@ -698,10 +699,9 @@
.startActivityInTaskFragment(tf, activityIntent, activityOptions,
hop.getCallingActivity());
if (!isStartResultSuccessful(result)) {
- final Throwable exception =
- new ActivityNotFoundException("start activity in taskFragment failed");
sendTaskFragmentOperationFailure(tf.getTaskFragmentOrganizer(),
- errorCallbackToken, exception);
+ errorCallbackToken,
+ convertStartFailureToThrowable(result, activityIntent));
}
break;
case HIERARCHY_OP_TYPE_REPARENT_ACTIVITY_TO_TASK_FRAGMENT:
@@ -1223,4 +1223,21 @@
mService.mTaskFragmentOrganizerController
.onTaskFragmentError(organizer, errorCallbackToken, exception);
}
+
+ private Throwable convertStartFailureToThrowable(int result, Intent intent) {
+ switch (result) {
+ case ActivityManager.START_INTENT_NOT_RESOLVED:
+ case ActivityManager.START_CLASS_NOT_FOUND:
+ return new ActivityNotFoundException("No Activity found to handle " + intent);
+ case ActivityManager.START_PERMISSION_DENIED:
+ return new SecurityException("Permission denied and not allowed to start activity "
+ + intent);
+ case ActivityManager.START_CANCELED:
+ return new AndroidRuntimeException("Activity could not be started for " + intent
+ + " with error code : " + result);
+ default:
+ return new AndroidRuntimeException("Start activity failed with error code : "
+ + result + " when starting " + intent);
+ }
+ }
}
diff --git a/services/incremental/TEST_MAPPING b/services/incremental/TEST_MAPPING
index 6aa8a93..f2ad068 100644
--- a/services/incremental/TEST_MAPPING
+++ b/services/incremental/TEST_MAPPING
@@ -1,20 +1,6 @@
{
"presubmit": [
{
- "name": "CtsContentTestCases",
- "options": [
- {
- "include-filter": "android.content.pm.cts.PackageManagerShellCommandTest"
- },
- {
- "include-filter": "android.content.pm.cts.PackageManagerShellCommandIncrementalTest"
- },
- {
- "include-filter": "android.content.pm.cts.ChecksumsTest"
- }
- ]
- },
- {
"name": "CtsPackageManagerStatsHostTestCases",
"options": [
{
@@ -29,6 +15,20 @@
"presubmit-large": [
{
"name": "CtsInstalledLoadingProgressHostTests"
+ },
+ {
+ "name": "CtsContentTestCases",
+ "options": [
+ {
+ "include-filter": "android.content.pm.cts.PackageManagerShellCommandTest"
+ },
+ {
+ "include-filter": "android.content.pm.cts.PackageManagerShellCommandIncrementalTest"
+ },
+ {
+ "include-filter": "android.content.pm.cts.ChecksumsTest"
+ }
+ ]
}
]
}
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java b/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java
index 850f881..327a80e 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityManagerTest.java
@@ -470,6 +470,8 @@
sendCommand(COMMAND_UNBIND_SERVICE, TEST_APP2, TEST_APP1, null);
runShellCommand("cmd deviceidle whitelist -" + TEST_APP1);
runShellCommand("cmd deviceidle whitelist -" + TEST_APP2);
+ am.forceStopPackage(TEST_APP1);
+ am.forceStopPackage(TEST_APP2);
}
}
@@ -700,6 +702,7 @@
am.removeOnUidImportanceListener(uidListener1);
am.removeOnUidImportanceListener(uidListener2);
am.removeOnUidImportanceListener(uidListener3);
+ am.forceStopPackage(TEST_APP1);
}
}
diff --git a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java
index b903b16..f30e97a 100644
--- a/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java
+++ b/services/tests/servicestests/src/com/android/server/hdmi/HdmiCecAtomLoggingTest.java
@@ -42,7 +42,7 @@
import android.os.RemoteException;
import android.os.test.TestLooper;
import android.platform.test.annotations.Presubmit;
-import android.stats.hdmi.nano.HdmiStatsEnums;
+import android.stats.hdmi.HdmiStatsEnums;
import androidx.test.InstrumentationRegistry;
import androidx.test.filters.SmallTest;
@@ -53,6 +53,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
+import org.mockito.Mockito;
import java.util.ArrayList;
import java.util.Collections;
@@ -134,6 +135,8 @@
mHdmiControlServiceSpy.onBootPhase(SystemService.PHASE_SYSTEM_SERVICES_READY);
mTestLooper.dispatchAll();
+
+ Mockito.reset(mHdmiCecAtomWriterSpy);
}
@Test
@@ -149,6 +152,7 @@
mPhysicalAddress);
mHdmiCecController.sendCommand(message);
+ mTestLooper.dispatchAll();
verify(mHdmiCecAtomWriterSpy, times(1)).messageReported(
eq(message),
@@ -193,4 +197,109 @@
eq(callerUid),
anyInt());
}
+
+ @Test
+ public void testMessageReported_writesAtom_userControlPressed() {
+ HdmiCecMessage message = HdmiCecMessageBuilder.buildUserControlPressed(
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ HdmiCecKeycode.CEC_KEYCODE_MUTE
+ );
+
+ mHdmiCecAtomWriterSpy.messageReported(
+ message,
+ HdmiStatsEnums.INCOMING,
+ 1234);
+
+ verify(mHdmiCecAtomWriterSpy, times(1))
+ .writeHdmiCecMessageReportedAtom(
+ 1234,
+ HdmiStatsEnums.INCOMING,
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_USER_CONTROL_PRESSED,
+ HdmiStatsEnums.SEND_MESSAGE_RESULT_UNKNOWN,
+ HdmiStatsEnums.VOLUME_MUTE,
+ HdmiCecAtomWriter.FEATURE_ABORT_OPCODE_UNKNOWN,
+ HdmiStatsEnums.FEATURE_ABORT_REASON_UNKNOWN);
+ }
+
+ @Test
+ public void testMessageReported_writesAtom_userControlPressed_noParams() {
+ HdmiCecMessage message = new HdmiCecMessage(
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_USER_CONTROL_PRESSED,
+ new byte[0]);
+
+ mHdmiCecAtomWriterSpy.messageReported(
+ message,
+ HdmiStatsEnums.INCOMING,
+ 1234);
+
+ verify(mHdmiCecAtomWriterSpy, times(1))
+ .writeHdmiCecMessageReportedAtom(
+ 1234,
+ HdmiStatsEnums.INCOMING,
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_USER_CONTROL_PRESSED,
+ HdmiStatsEnums.SEND_MESSAGE_RESULT_UNKNOWN,
+ HdmiStatsEnums.USER_CONTROL_PRESSED_COMMAND_UNKNOWN,
+ HdmiCecAtomWriter.FEATURE_ABORT_OPCODE_UNKNOWN,
+ HdmiStatsEnums.FEATURE_ABORT_REASON_UNKNOWN);
+ }
+
+ @Test
+ public void testMessageReported_writesAtom_featureAbort() {
+ HdmiCecMessage message = HdmiCecMessageBuilder.buildFeatureAbortCommand(
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_RECORD_ON,
+ Constants.ABORT_UNRECOGNIZED_OPCODE
+ );
+
+ mHdmiCecAtomWriterSpy.messageReported(
+ message,
+ HdmiStatsEnums.INCOMING,
+ 1234);
+
+ verify(mHdmiCecAtomWriterSpy, times(1))
+ .writeHdmiCecMessageReportedAtom(
+ 1234,
+ HdmiStatsEnums.INCOMING,
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_FEATURE_ABORT,
+ HdmiStatsEnums.SEND_MESSAGE_RESULT_UNKNOWN,
+ HdmiStatsEnums.USER_CONTROL_PRESSED_COMMAND_UNKNOWN,
+ Constants.MESSAGE_RECORD_ON,
+ HdmiStatsEnums.UNRECOGNIZED_OPCODE);
+ }
+
+ @Test
+ public void testMessageReported_writesAtom_featureAbort_noParams() {
+ HdmiCecMessage message = new HdmiCecMessage(
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_FEATURE_ABORT,
+ new byte[0]);
+
+ mHdmiCecAtomWriterSpy.messageReported(
+ message,
+ HdmiStatsEnums.INCOMING,
+ 1234);
+
+ verify(mHdmiCecAtomWriterSpy, times(1))
+ .writeHdmiCecMessageReportedAtom(
+ 1234,
+ HdmiStatsEnums.INCOMING,
+ Constants.ADDR_TV,
+ Constants.ADDR_PLAYBACK_1,
+ Constants.MESSAGE_FEATURE_ABORT,
+ HdmiStatsEnums.SEND_MESSAGE_RESULT_UNKNOWN,
+ HdmiStatsEnums.USER_CONTROL_PRESSED_COMMAND_UNKNOWN,
+ HdmiCecAtomWriter.FEATURE_ABORT_OPCODE_UNKNOWN,
+ HdmiStatsEnums.FEATURE_ABORT_REASON_UNKNOWN);
+ }
}
diff --git a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
index 1947481..3f8cf9c 100644
--- a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
+++ b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/SoundHw2CompatTest.java
@@ -76,7 +76,7 @@
public static Iterable<Object[]> data() {
List<Object[]> result = new LinkedList<>();
- for (String version : new String[]{"V2_0", "V2_1", "V2_2", "V2_3", "V2_4",}) {
+ for (String version : new String[]{"V2_0", "V2_1", "V2_2", "V2_3",}) {
for (boolean concurrentCapture : new boolean[]{false, true}) {
result.add(new Object[]{version, concurrentCapture});
}
@@ -113,9 +113,7 @@
|| descriptor.equals("android.hardware.soundtrigger@2.2::ISoundTriggerHw")
&& mHalDriver instanceof android.hardware.soundtrigger.V2_2.ISoundTriggerHw
|| descriptor.equals("android.hardware.soundtrigger@2.3::ISoundTriggerHw")
- && mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw
- || descriptor.equals("android.hardware.soundtrigger@2.4::ISoundTriggerHw")
- && mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
+ && mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
return mHalDriver;
}
return null;
@@ -269,44 +267,9 @@
return handle;
}
- private int loadGenericModel_2_4(ISoundTriggerHal.ModelCallback canonicalCallback)
- throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- final int handle = 29;
- ArgumentCaptor<android.hardware.soundtrigger.V2_1.ISoundTriggerHw.SoundModel> modelCaptor =
- ArgumentCaptor.forClass(
- android.hardware.soundtrigger.V2_1.ISoundTriggerHw.SoundModel.class);
- ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback> callbackCaptor =
- ArgumentCaptor.forClass(
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.class);
-
- doAnswer(invocation -> {
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadSoundModel_2_4Callback
- resultCallback = invocation.getArgument(2);
-
- // This is the return of this method.
- resultCallback.onValues(0, handle);
- return null;
- }).when(driver_2_4).loadSoundModel_2_4(any(), any(), any());
-
- assertEquals(handle,
- mCanonical.loadSoundModel(TestUtil.createGenericSoundModel(), canonicalCallback));
-
- verify(driver_2_4).loadSoundModel_2_4(modelCaptor.capture(), callbackCaptor.capture(),
- any());
-
- TestUtil.validateGenericSoundModel_2_1(modelCaptor.getValue());
- validateCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
- return handle;
- }
-
private int loadGenericModel(ISoundTriggerHal.ModelCallback canonicalCallback)
throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- return loadGenericModel_2_4(canonicalCallback);
- } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
+ if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
return loadGenericModel_2_1(canonicalCallback);
} else {
return loadGenericModel_2_0(canonicalCallback);
@@ -322,8 +285,6 @@
@Test
public void testMaxModels() throws Exception {
- assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw);
-
// Register global callback.
ISoundTriggerHal.GlobalCallback globalCallback = mock(
ISoundTriggerHal.GlobalCallback.class);
@@ -358,37 +319,6 @@
verify(globalCallback).onResourcesAvailable();
}
- private void testLoadGenericModelBusy_2_4() throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- doAnswer(invocation -> {
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadSoundModel_2_4Callback
- resultCallback = invocation.getArgument(2);
-
- // This is the return of this method.
- resultCallback.onValues(-OsConstants.EBUSY, 0);
- return null;
- }).when(driver_2_4).loadSoundModel_2_4(any(), any(), any());
-
- ISoundTriggerHal.ModelCallback canonicalCallback = mock(
- ISoundTriggerHal.ModelCallback.class);
- try {
- mCanonical.loadSoundModel(TestUtil.createGenericSoundModel(), canonicalCallback);
- fail("Expected an exception");
- } catch (RecoverableException e) {
- assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
- }
- verify(driver_2_4).loadSoundModel_2_4(any(), any(), any());
- }
-
- @Test
- public void testLoadGenericModelBusy() throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- testLoadGenericModelBusy_2_4();
- }
- }
-
private int loadPhraseModel_2_0(ISoundTriggerHal.ModelCallback canonicalCallback)
throws Exception {
final int handle = 29;
@@ -452,43 +382,8 @@
return handle;
}
- private int loadPhraseModel_2_4(ISoundTriggerHal.ModelCallback canonicalCallback)
- throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- final int handle = 29;
- ArgumentCaptor<android.hardware.soundtrigger.V2_1.ISoundTriggerHw.PhraseSoundModel>
- modelCaptor = ArgumentCaptor.forClass(
- android.hardware.soundtrigger.V2_1.ISoundTriggerHw.PhraseSoundModel.class);
- ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback> callbackCaptor =
- ArgumentCaptor.forClass(
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback.class);
-
- doAnswer(invocation -> {
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadPhraseSoundModel_2_4Callback
- resultCallback = invocation.getArgument(2);
-
- // This is the return of this method.
- resultCallback.onValues(0, handle);
- return null;
- }).when(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
-
- assertEquals(handle, mCanonical.loadPhraseSoundModel(TestUtil.createPhraseSoundModel(),
- canonicalCallback));
-
- verify(driver_2_4).loadPhraseSoundModel_2_4(modelCaptor.capture(), callbackCaptor.capture(),
- any());
-
- TestUtil.validatePhraseSoundModel_2_1(modelCaptor.getValue());
- validateCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
- return handle;
- }
-
public int loadPhraseModel(ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- return loadPhraseModel_2_4(canonicalCallback);
- } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
+ if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
return loadPhraseModel_2_1(canonicalCallback);
} else {
return loadPhraseModel_2_0(canonicalCallback);
@@ -502,37 +397,6 @@
loadPhraseModel(canonicalCallback);
}
- private void testLoadPhraseModelBusy_2_4() throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- doAnswer(invocation -> {
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw.loadPhraseSoundModel_2_4Callback
- resultCallback = invocation.getArgument(2);
-
- // This is the return of this method.
- resultCallback.onValues(-OsConstants.EBUSY, 0);
- return null;
- }).when(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
-
- ISoundTriggerHal.ModelCallback canonicalCallback = mock(
- ISoundTriggerHal.ModelCallback.class);
- try {
- mCanonical.loadPhraseSoundModel(TestUtil.createPhraseSoundModel(), canonicalCallback);
- fail("Expected an exception");
- } catch (RecoverableException e) {
- assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
- }
- verify(driver_2_4).loadPhraseSoundModel_2_4(any(), any(), any());
- }
-
- @Test
- public void testLoadPhraseModelBusy() throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- testLoadPhraseModelBusy_2_4();
- }
- }
-
@Test
public void testUnloadModel() throws Exception {
mCanonical.unloadSoundModel(14);
@@ -596,25 +460,9 @@
TestUtil.validateRecognitionConfig_2_3(configCaptor.getValue(), 808, 909);
}
- private void startRecognition_2_4(int handle) throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
- ArgumentCaptor<android.hardware.soundtrigger.V2_3.RecognitionConfig> configCaptor =
- ArgumentCaptor.forClass(android.hardware.soundtrigger.V2_3.RecognitionConfig.class);
-
- when(driver_2_4.startRecognition_2_4(eq(handle), any())).thenReturn(0);
-
- RecognitionConfig config = TestUtil.createRecognitionConfig();
- mCanonical.startRecognition(handle, 21, 22, config);
- verify(driver_2_4).startRecognition_2_4(eq(handle), configCaptor.capture());
- TestUtil.validateRecognitionConfig_2_3(configCaptor.getValue(), 21, 22);
- }
-
private void startRecognition(int handle, ISoundTriggerHal.ModelCallback canonicalCallback)
throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- startRecognition_2_4(handle);
- } else if (mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
+ if (mHalDriver instanceof android.hardware.soundtrigger.V2_3.ISoundTriggerHw) {
startRecognition_2_3(handle);
} else if (mHalDriver instanceof android.hardware.soundtrigger.V2_1.ISoundTriggerHw) {
startRecognition_2_1(handle, canonicalCallback);
@@ -634,41 +482,9 @@
startRecognition(handle, canonicalCallback);
}
- private void testStartRecognitionBusy_2_4() throws Exception {
- final android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- final int handle = 68;
- when(driver_2_4.startRecognition_2_4(eq(handle), any())).thenReturn(-OsConstants.EBUSY);
-
- RecognitionConfig config = TestUtil.createRecognitionConfig();
- try {
- mCanonical.startRecognition(handle, 34, 35, config);
- fail("Expected an exception");
- } catch (RecoverableException e) {
- assertEquals(Status.RESOURCE_CONTENTION, e.errorCode);
- }
- verify(driver_2_4).startRecognition_2_4(eq(handle), any());
- }
-
- @Test
- public void testStartRecognitionBusy() throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- testStartRecognitionBusy_2_4();
- }
- }
-
- @Test
- public void testNoRegisterCaptureStateListener() {
- assumeTrue(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
- || mSupportConcurrentCapture);
- verify(mCaptureStateNotifier, never()).registerListener(any());
- }
-
@Test
public void testConcurrentCaptureAbort() throws Exception {
- assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
- || mSupportConcurrentCapture);
+ assumeFalse(mSupportConcurrentCapture);
verify(mCaptureStateNotifier, atLeast(1)).registerListener(any());
// Register global callback.
@@ -707,8 +523,7 @@
@Test
public void testConcurrentCaptureReject() throws Exception {
- assumeFalse(mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw
- || mSupportConcurrentCapture);
+ assumeFalse(mSupportConcurrentCapture);
verify(mCaptureStateNotifier, atLeast(1)).registerListener(any());
// Register global callback.
@@ -858,28 +673,9 @@
// We just care that it doesn't throw.
}
- private void testGlobalCallback_2_4() throws Exception {
- android.hardware.soundtrigger.V2_4.ISoundTriggerHw driver_2_4 =
- (android.hardware.soundtrigger.V2_4.ISoundTriggerHw) mHalDriver;
-
- ISoundTriggerHal.GlobalCallback canonicalCallback = mock(
- ISoundTriggerHal.GlobalCallback.class);
- mCanonical.registerCallback(canonicalCallback);
-
- ArgumentCaptor<android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback>
- callbackCaptor = ArgumentCaptor.forClass(
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback.class);
- verify(driver_2_4).registerGlobalCallback(callbackCaptor.capture());
- validateGlobalCallback_2_4(callbackCaptor.getValue(), canonicalCallback);
- }
-
@Test
public void testGlobalCallback() throws Exception {
- if (mHalDriver instanceof android.hardware.soundtrigger.V2_4.ISoundTriggerHw) {
- testGlobalCallback_2_4();
- } else {
- testGlobalCallback_2_0();
- }
+ testGlobalCallback_2_0();
}
@Test
@@ -908,14 +704,6 @@
verify(mHalDriver).interfaceDescriptor();
}
- private void validateGlobalCallback_2_4(
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback hwCallback,
- ISoundTriggerHal.GlobalCallback canonicalCallback) throws Exception {
- hwCallback.onResourcesAvailable();
- mCanonical.flushCallbacks();
- verify(canonicalCallback).onResourcesAvailable();
- }
-
private void validateCallback_2_0(
android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback hwCallback,
ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
@@ -985,48 +773,6 @@
clearInvocations(canonicalCallback);
}
- private void validateCallback_2_4(
- android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback hwCallback,
- ISoundTriggerHal.ModelCallback canonicalCallback) throws Exception {
- {
- final int handle = 85;
- final int status =
- android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback.RecognitionStatus.ABORT;
- ArgumentCaptor<RecognitionEvent> eventCaptor = ArgumentCaptor.forClass(
- RecognitionEvent.class);
-
- hwCallback.recognitionCallback_2_1(TestUtil.createRecognitionEvent_2_1(handle, status),
- 99);
- mCanonical.flushCallbacks();
- verify(canonicalCallback).recognitionCallback(eq(handle), eventCaptor.capture());
- TestUtil.validateRecognitionEvent(eventCaptor.getValue(), RecognitionStatus.ABORTED);
- }
-
- {
- final int handle = 92;
- final int status =
- android.hardware.soundtrigger.V2_0.ISoundTriggerHwCallback.RecognitionStatus.SUCCESS;
- ArgumentCaptor<PhraseRecognitionEvent> eventCaptor = ArgumentCaptor.forClass(
- PhraseRecognitionEvent.class);
-
- hwCallback.phraseRecognitionCallback_2_1(
- TestUtil.createPhraseRecognitionEvent_2_1(handle, status), 99);
- mCanonical.flushCallbacks();
- verify(canonicalCallback).phraseRecognitionCallback(eq(handle), eventCaptor.capture());
- TestUtil.validatePhraseRecognitionEvent(eventCaptor.getValue(),
- RecognitionStatus.SUCCESS);
- }
-
- {
- final int handle = 23;
- hwCallback.modelUnloaded(handle);
- mCanonical.flushCallbacks();
- verify(canonicalCallback).modelUnloaded(handle);
- }
- verifyNoMoreInteractions(canonicalCallback);
- clearInvocations(canonicalCallback);
- }
-
public static class CaptureStateNotifier implements ICaptureStateNotifier {
private final List<Listener> mListeners = new LinkedList<>();
diff --git a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
index 6ed9dde..f54f144 100644
--- a/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
+++ b/services/tests/servicestests/src/com/android/server/soundtrigger_middleware/TestUtil.java
@@ -22,7 +22,7 @@
import android.annotation.NonNull;
import android.hardware.soundtrigger.V2_1.ISoundTriggerHw;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback;
+import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback;
import android.media.AudioFormat;
import android.media.MediaFormat;
import android.media.audio.common.AudioChannelLayout;
diff --git a/services/tests/servicestests/src/com/android/server/tare/AgentTest.java b/services/tests/servicestests/src/com/android/server/tare/AgentTrendCalculatorTest.java
similarity index 96%
rename from services/tests/servicestests/src/com/android/server/tare/AgentTest.java
rename to services/tests/servicestests/src/com/android/server/tare/AgentTrendCalculatorTest.java
index 546b84a..b1b53fc 100644
--- a/services/tests/servicestests/src/com/android/server/tare/AgentTest.java
+++ b/services/tests/servicestests/src/com/android/server/tare/AgentTrendCalculatorTest.java
@@ -40,10 +40,10 @@
import java.util.List;
-/** Tests various aspects of the Agent. */
+/** Tests the TrendCalculator in the Agent. */
@RunWith(AndroidJUnit4.class)
@SmallTest
-public class AgentTest {
+public class AgentTrendCalculatorTest {
private MockEconomicPolicy mEconomicPolicy;
@@ -98,7 +98,7 @@
}
@Test
- public void testTrendCalculator_NoOngoingEvents() {
+ public void testNoOngoingEvents() {
TrendCalculator trendCalculator = new TrendCalculator();
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_TIMEOUT, 20);
@@ -128,7 +128,7 @@
}
@Test
- public void testTrendCalculator_NoAffordabilityNotes() {
+ public void testNoAffordabilityNotes() {
TrendCalculator trendCalculator = new TrendCalculator();
OngoingEvent[] events = new OngoingEvent[]{
@@ -165,7 +165,7 @@
}
@Test
- public void testTrendCalculator_NoTrendToThreshold() {
+ public void testNoTrendToThreshold() {
TrendCalculator trendCalculator = new TrendCalculator();
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_MAX_RUNNING, 10);
@@ -213,7 +213,7 @@
}
@Test
- public void testTrendCalculator_SimpleTrendToThreshold() {
+ public void testSimpleTrendToThreshold() {
TrendCalculator trendCalculator = new TrendCalculator();
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_MAX_START, 20);
@@ -257,7 +257,7 @@
}
@Test
- public void testTrendCalculator_SelectCorrectThreshold() {
+ public void testSelectCorrectThreshold() {
TrendCalculator trendCalculator = new TrendCalculator();
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_MAX_START, 20);
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_HIGH_START, 15);
@@ -307,7 +307,7 @@
}
@Test
- public void testTrendCalculator_TrendsToBothThresholds() {
+ public void testTrendsToBothThresholds() {
TrendCalculator trendCalculator = new TrendCalculator();
mEconomicPolicy.mEventCosts.put(JobSchedulerEconomicPolicy.ACTION_JOB_MAX_START, 20);
mEconomicPolicy.mEventCosts.put(AlarmManagerEconomicPolicy.ACTION_ALARM_CLOCK, 50);
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
index 11e3fd4..a165e1c 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java
@@ -48,7 +48,6 @@
import android.view.RemoteAnimationTarget;
import android.view.WindowManager;
-import androidx.test.filters.FlakyTest;
import androidx.test.filters.SmallTest;
import org.junit.Before;
@@ -94,11 +93,10 @@
assertEquals(WindowManager.TRANSIT_OLD_UNSET,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null, null, false));
+ mDisplayContent.mChangingContainers, null, null, false));
}
@Test
- @FlakyTest(bugId = 131005232)
public void testTranslucentOpen() {
final ActivityRecord behind = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
@@ -112,12 +110,11 @@
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
- mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null, null, false));
+ mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
+ mDisplayContent.mChangingContainers, null, null, false));
}
@Test
- @FlakyTest(bugId = 131005232)
public void testTranslucentClose() {
final ActivityRecord behind = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
@@ -129,11 +126,10 @@
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null, null, false));
+ mDisplayContent.mChangingContainers, null, null, false));
}
@Test
- @FlakyTest(bugId = 131005232)
public void testChangeIsNotOverwritten() {
final ActivityRecord behind = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
@@ -144,14 +140,14 @@
mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
mDisplayContent.mOpeningApps.add(behind);
mDisplayContent.mOpeningApps.add(translucentOpening);
+ mDisplayContent.mChangingContainers.add(translucentOpening.getTask());
assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null, null, false));
+ mDisplayContent.mChangingContainers, null, null, false));
}
@Test
- @FlakyTest(bugId = 131005232)
public void testTransitWithinTask() {
final ActivityRecord opening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
@@ -198,7 +194,7 @@
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- appWindowClosing, null, false));
+ mDisplayContent.mChangingContainers, appWindowClosing, null, false));
}
@Test
@@ -229,7 +225,7 @@
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- appWindowClosing, null, false));
+ mDisplayContent.mChangingContainers, appWindowClosing, null, false));
}
@Test
diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
index 67aac13..a0a3ce7 100644
--- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java
@@ -18,11 +18,14 @@
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
+import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
+import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
+import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
@@ -32,6 +35,7 @@
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
+import static com.android.server.wm.WindowContainer.POSITION_TOP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -39,6 +43,7 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.platform.test.annotations.Presubmit;
@@ -85,8 +90,8 @@
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /*skipAppTransitionAnimation*/));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
}
@Test
@@ -100,8 +105,8 @@
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /*skipAppTransitionAnimation*/));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
}
@Test
@@ -115,8 +120,8 @@
assertEquals(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /*skipAppTransitionAnimation*/));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
}
@Test
@@ -130,8 +135,8 @@
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /*skipAppTransitionAnimation*/));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
}
@Test
@@ -145,8 +150,44 @@
assertEquals(TRANSIT_OLD_UNSET,
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- true /*skipAppTransitionAnimation*/));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, true /*skipAppTransitionAnimation*/));
+ }
+
+ @Test
+ public void testTaskChangeWindowingMode() {
+ final ActivityRecord activity = createActivityRecord(mDc);
+
+ mDc.prepareAppTransition(TRANSIT_OPEN);
+ mDc.prepareAppTransition(TRANSIT_CHANGE);
+ mDc.mOpeningApps.add(activity); // Make sure TRANSIT_CHANGE has the priority
+ mDc.mChangingContainers.add(activity.getTask());
+
+ assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
+ AppTransitionController.getTransitCompatType(mDc.mAppTransition,
+ mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
+ }
+
+ @Test
+ public void testTaskFragmentChange() {
+ final ActivityRecord activity = createActivityRecord(mDc);
+ final TaskFragment taskFragment = new TaskFragment(mAtm, new Binder(),
+ true /* createdByOrganizer */, true /* isEmbedded */);
+ activity.getTask().addChild(taskFragment, POSITION_TOP);
+ activity.reparent(taskFragment, POSITION_TOP);
+
+ mDc.prepareAppTransition(TRANSIT_OPEN);
+ mDc.prepareAppTransition(TRANSIT_CHANGE);
+ mDc.mOpeningApps.add(activity); // Make sure TRANSIT_CHANGE has the priority
+ mDc.mChangingContainers.add(taskFragment);
+
+ assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CHANGE,
+ AppTransitionController.getTransitCompatType(mDc.mAppTransition,
+ mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
}
@Test
@@ -159,9 +200,9 @@
mDisplayContent.mOpeningApps.add(activity);
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
- mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /* skipAppTransitionAnimation */));
+ mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
}
@Test
@@ -175,8 +216,8 @@
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /* skipAppTransitionAnimation */));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
}
@Test
@@ -190,8 +231,8 @@
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /* skipAppTransitionAnimation */));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
}
@Test
@@ -205,8 +246,8 @@
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
- null /* wallpaperTarget */, null /* oldWallpaper */,
- false /* skipAppTransitionAnimation */));
+ mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
+ null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
}
/**
diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt
index 3c94be0..9392190 100644
--- a/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt
+++ b/tests/FlickerTests/src/com/android/server/wm/flicker/quickswitch/QuickSwitchFromLauncherTest.kt
@@ -197,11 +197,8 @@
}
/**
- * Checks that the [testApp] window starts off invisible and once it becomes visible, stays
- * visible until the end of the transition.
- *
- * NOTE: It does not ensure that the app becomes visible at some point ([testApp] can stay
- * invisible throughout and pass this check), that is what [endsWithAppBeingVisible] is for.
+ * Checks that [testApp]'s window starts off invisible and becomes visible at some point before
+ * the end of the transition and then stays visible until the end of the transition.
*/
@Postsubmit
@Test
@@ -214,11 +211,8 @@
}
/**
- * Checks that the [testApp] layer starts off invisible and once it becomes visible, stays
- * visible until the end of the transition.
- *
- * NOTE: It does not ensure that the app becomes visible at some point ([testApp] can stay
- * invisible throughout and pass this check).
+ * Checks that [testApp]'s layer starts off invisible and becomes visible at some point before
+ * the end of the transition and then stays visible until the end of the transition.
*/
@Postsubmit
@Test
@@ -231,11 +225,8 @@
}
/**
- * Checks that the launcher window starts off visible and once it becomes invisible, stays
- * invisible until the end of the transition.
- *
- * NOTE: It does not ensure that the launcher becomes invisible at some point, (the launcher can
- * stay invisible throughout and pass this check).
+ * Checks that the launcher window starts off visible and becomes invisible at some point before
+ * the end of the transition and then stays invisible until the end of the transition.
*/
@Postsubmit
@Test
@@ -248,11 +239,8 @@
}
/**
- * Checks that the launcher layer starts off visible and once it becomes invisible, stays
- * invisible until the end of the transition.
- *
- * NOTE: It does not ensure that the launcher becomes invisible at some point, (the launcher can
- * stay invisible throughout and pass this check).
+ * Checks that the launcher layer starts off visible and becomes invisible at some point before
+ * the end of the transition and then stays invisible until the end of the transition.
*/
@Postsubmit
@Test