diff options
41 files changed, 983 insertions, 354 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index a9febc3db62b..3821b8a5c307 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -47463,7 +47463,6 @@ package android.telephony { field public static final long NETWORK_TYPE_BITMASK_IWLAN = 131072L; // 0x20000L field public static final long NETWORK_TYPE_BITMASK_LTE = 4096L; // 0x1000L field @Deprecated public static final long NETWORK_TYPE_BITMASK_LTE_CA = 262144L; // 0x40000L - field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final long NETWORK_TYPE_BITMASK_NB_IOT_NTN = 1048576L; // 0x100000L field public static final long NETWORK_TYPE_BITMASK_NR = 524288L; // 0x80000L field public static final long NETWORK_TYPE_BITMASK_TD_SCDMA = 65536L; // 0x10000L field public static final long NETWORK_TYPE_BITMASK_UMTS = 4L; // 0x4L @@ -47483,7 +47482,6 @@ package android.telephony { field @Deprecated public static final int NETWORK_TYPE_IDEN = 11; // 0xb field public static final int NETWORK_TYPE_IWLAN = 18; // 0x12 field public static final int NETWORK_TYPE_LTE = 13; // 0xd - field @FlaggedApi("com.android.internal.telephony.flags.satellite_system_apis") public static final int NETWORK_TYPE_NB_IOT_NTN = 21; // 0x15 field public static final int NETWORK_TYPE_NR = 20; // 0x14 field public static final int NETWORK_TYPE_TD_SCDMA = 17; // 0x11 field public static final int NETWORK_TYPE_UMTS = 3; // 0x3 diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 9590e1ab19c9..e5dcc7d8ba7f 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -5088,6 +5088,7 @@ package android.hardware.contexthub { field public static final int REASON_ENDPOINT_STOPPED = 6; // 0x6 field public static final int REASON_FAILURE = 0; // 0x0 field public static final int REASON_OPEN_ENDPOINT_SESSION_REQUEST_REJECTED = 3; // 0x3 + field public static final int REASON_PERMISSION_DENIED = 9; // 0x9 } public static final class HubEndpoint.Builder { diff --git a/core/java/android/database/sqlite/SQLiteRawStatement.java b/core/java/android/database/sqlite/SQLiteRawStatement.java index 3f3e46b4334c..ce2334a8247a 100644 --- a/core/java/android/database/sqlite/SQLiteRawStatement.java +++ b/core/java/android/database/sqlite/SQLiteRawStatement.java @@ -533,11 +533,11 @@ public final class SQLiteRawStatement implements Closeable { } /** - * Return the number of columns in the current result row. + * Return the number of columns in the result set for the statement. * * @see <a href="http://sqlite.org/c3ref/column_count.html">sqlite3_column_count</a> * - * @return The number of columns in the result row. + * @return The number of columns in the result set. * @throws IllegalStateException if the statement is closed or this is a foreign thread. */ public int getResultColumnCount() { diff --git a/core/java/android/hardware/contexthub/HubEndpoint.java b/core/java/android/hardware/contexthub/HubEndpoint.java index 1f12bbf4d074..ee4675c6a46f 100644 --- a/core/java/android/hardware/contexthub/HubEndpoint.java +++ b/core/java/android/hardware/contexthub/HubEndpoint.java @@ -66,13 +66,14 @@ public class HubEndpoint { REASON_CLOSE_ENDPOINT_SESSION_REQUESTED, REASON_ENDPOINT_INVALID, REASON_ENDPOINT_STOPPED, + REASON_PERMISSION_DENIED, }) public @interface Reason {} /** Unclassified failure */ public static final int REASON_FAILURE = 0; - // The values 1 and 2 are reserved at the Context Hub HAL but not exposed to apps. + // The values 1-2 are reserved at the Context Hub HAL but not exposed to apps. /** The peer rejected the request to open this endpoint session. */ public static final int REASON_OPEN_ENDPOINT_SESSION_REQUEST_REJECTED = 3; @@ -83,6 +84,11 @@ public class HubEndpoint { /** The peer endpoint is invalid. */ public static final int REASON_ENDPOINT_INVALID = 5; + // The values 6-8 are reserved at the Context Hub HAL but not exposed to apps. + + /** The endpoint did not have the required permissions. */ + public static final int REASON_PERMISSION_DENIED = 9; + /** * The endpoint is now stopped. The app should retrieve the endpoint info using {@link * android.hardware.location.ContextHubManager#findEndpoints} or register updates through diff --git a/core/java/android/window/flags/lse_desktop_experience.aconfig b/core/java/android/window/flags/lse_desktop_experience.aconfig index cfe44f812220..6caa20e29c17 100644 --- a/core/java/android/window/flags/lse_desktop_experience.aconfig +++ b/core/java/android/window/flags/lse_desktop_experience.aconfig @@ -510,4 +510,11 @@ flag { metadata { purpose: PURPOSE_BUGFIX } +} + +flag { + name: "enable_per_display_desktop_wallpaper_activity" + namespace: "lse_desktop_experience" + description: "Enables having a DesktopWallpaperActivity at a per-display level." + bug: "381935663" }
\ No newline at end of file diff --git a/core/jni/android_database_SQLiteRawStatement.cpp b/core/jni/android_database_SQLiteRawStatement.cpp index 32c2ef73a5b1..5fa808361178 100644 --- a/core/jni/android_database_SQLiteRawStatement.cpp +++ b/core/jni/android_database_SQLiteRawStatement.cpp @@ -81,10 +81,11 @@ static bool throwIfError(JNIEnv *env, jlong stmtPtr) { return true; } -// This throws a SQLiteBindOrColumnIndexOutOfRangeException if the column index is out of -// bounds. It throws SQLiteMisuseException if the statement's column count is zero; that -// generally occurs because the client has forgotten to call step() or the client has stepped -// past the end of the query. The function returns true if an exception was thrown. +// This throws a SQLiteBindOrColumnIndexOutOfRangeException if the column index is outside the +// bounds of the row data set. It throws SQLiteMisuseException if the statement's data column +// count is zero; that generally occurs because the client has forgotten to call step() or the +// client has stepped past the end of the query. The function returns true if an exception was +// thrown. static bool throwIfInvalidColumn(JNIEnv *env, jlong stmtPtr, jint col) { int count = sqlite3_data_count(stmt(stmtPtr)); if (throwIfError(env, stmtPtr)) { @@ -106,6 +107,24 @@ static bool throwIfInvalidColumn(JNIEnv *env, jlong stmtPtr, jint col) { } } +// This throws a SQLiteBindOrColumnIndexOutOfRangeException if the column index is outside the +// bounds of the result set. (This is not the same as the data columns in a row). The function +// returns true if an exception was thrown. +static bool throwIfInvalidResultColumn(JNIEnv *env, jlong stmtPtr, jint col) { + int count = sqlite3_column_count(stmt(stmtPtr)); + if (throwIfError(env, stmtPtr)) { + return true; + } else if (col < 0 || col >= count) { + std::string message = android::base::StringPrintf( + "column index %d out of bounds [0,%d]", col, count - 1); + char const * errmsg = sqlite3_errstr(SQLITE_RANGE); + throw_sqlite3_exception(env, SQLITE_RANGE, errmsg, message.c_str()); + return true; + } else { + return false; + } +} + static jint bindParameterCount(JNIEnv* env, jclass, jlong stmtPtr) { return sqlite3_bind_parameter_count(stmt(stmtPtr)); } @@ -235,7 +254,7 @@ static jint columnType(JNIEnv* env, jclass, jlong stmtPtr, jint col) { } static jstring columnName(JNIEnv* env, jclass, jlong stmtPtr, jint col) { - if (throwIfInvalidColumn(env, stmtPtr, col)) { + if (throwIfInvalidResultColumn(env, stmtPtr, col)) { return nullptr; } const jchar* name = static_cast<const jchar*>(sqlite3_column_name16(stmt(stmtPtr), col)); diff --git a/core/tests/coretests/src/android/database/sqlite/SQLiteRawStatementTest.java b/core/tests/coretests/src/android/database/sqlite/SQLiteRawStatementTest.java index 13b12fcf300a..51a43ac01d75 100644 --- a/core/tests/coretests/src/android/database/sqlite/SQLiteRawStatementTest.java +++ b/core/tests/coretests/src/android/database/sqlite/SQLiteRawStatementTest.java @@ -1048,5 +1048,28 @@ public class SQLiteRawStatementTest { } finally { mDatabase.endTransaction(); } + + // Ensure that column names and column types can be fetched even if the statement is not + // stepped. A new SQL statement is created to avoid interaction from the statement cache. + mDatabase.beginTransactionReadOnly(); + try (SQLiteRawStatement s = mDatabase.createRawStatement("SELECT * from t1 WHERE j = 3")) { + // Do not step the statement. + assertEquals("i", s.getColumnName(0)); + assertEquals("j", s.getColumnName(1)); + } finally { + mDatabase.endTransaction(); + } + + mDatabase.beginTransactionReadOnly(); + try (SQLiteRawStatement s = mDatabase.createRawStatement("SELECT * from t1")) { + // Do not step the statement. + s.getColumnName(3); // out-of-range column + fail("JNI exception not thrown"); + } catch (SQLiteBindOrColumnIndexOutOfRangeException e) { + // Passing case. + } finally { + mDatabase.endTransaction(); + } + } } diff --git a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/split/SplitScreenConstants.java b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/split/SplitScreenConstants.java index 86be0d4a4ea5..b48296f5f76a 100644 --- a/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/split/SplitScreenConstants.java +++ b/libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/split/SplitScreenConstants.java @@ -58,6 +58,11 @@ public class SplitScreenConstants { */ public static final int SPLIT_POSITION_BOTTOM_OR_RIGHT = 1; + /** + * Deprecated and will be replaced fully by @SplitIndex. With support for 3+ apps in split, + * existing references to top/left and bottom/right will be replaced by INDEX_0 and INDEX_1 + * respectively. For now they can be used interchangeably, the underlying ints are the same. + */ @IntDef(prefix = {"SPLIT_POSITION_"}, value = { SPLIT_POSITION_UNDEFINED, SPLIT_POSITION_TOP_OR_LEFT, @@ -85,6 +90,21 @@ public class SplitScreenConstants { public @interface SplitIndex { } + /** + * Return the @SplitIndex constant for a given integer index. @SplitIndex is the replacement + * for @SplitPosition, and will be used interchangeably with @SplitPosition to support 3+ apps + * in split. + */ + public static int getIndex(int i) { + return switch (i) { + case 0 -> SPLIT_INDEX_0; + case 1 -> SPLIT_INDEX_1; + case 2 -> SPLIT_INDEX_2; + case 3 -> SPLIT_INDEX_3; + default -> SPLIT_INDEX_UNDEFINED; + }; + } + /** Signifies that user is currently not in split screen. */ public static final int NOT_IN_SPLIT = -1; diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index ee229158decc..3ac71bf8ef67 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -1339,16 +1339,6 @@ flag { } flag { - name: "validate_keyboard_shortcut_helper_icon_uri" - namespace: "systemui" - description: "Adds a check that the caller can access the content URI of an icon in the shortcut helper." - bug: "331180422" - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { name: "glanceable_hub_allow_keyguard_when_dreaming" namespace: "systemui" description: "Allows users to exit dream to keyguard with glanceable hub enabled" diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt index a55b6d720dd6..15edd0b05bfc 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/CommunalHub.kt @@ -151,6 +151,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.DpSize +import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.IntRect import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.LayoutDirection @@ -947,12 +948,28 @@ private fun BoxScope.CommunalHubLazyGrid( } } } else { + val itemAlpha = + if (communalResponsiveGrid()) { + val percentVisible by + remember(gridState, index) { + derivedStateOf { calculatePercentVisible(gridState, index) } + } + animateFloatAsState(percentVisible) + } else { + null + } + CommunalContent( model = item, viewModel = viewModel, size = size, selected = false, - modifier = Modifier.requiredSize(dpSize).animateItem(), + modifier = + Modifier.requiredSize(dpSize).animateItem().thenIf( + communalResponsiveGrid() + ) { + Modifier.graphicsLayer { alpha = itemAlpha?.value ?: 1f } + }, index = index, contentListState = contentListState, interactionHandler = interactionHandler, @@ -1856,6 +1873,44 @@ private fun CommunalContentModel.getSpanOrMax(maxSpan: Int?) = size.span } +private fun IntRect.percentOverlap(other: IntRect): Float { + val intersection = intersect(other) + if (intersection.width < 0 || intersection.height < 0) { + return 0f + } + val overlapArea = intersection.width * intersection.height + val area = width * height + return overlapArea.toFloat() / area.toFloat() +} + +private fun calculatePercentVisible(state: LazyGridState, index: Int): Float { + val viewportSize = state.layoutInfo.viewportSize + val visibleRect = + IntRect( + offset = + IntOffset( + state.layoutInfo.viewportStartOffset + state.layoutInfo.beforeContentPadding, + 0, + ), + size = + IntSize( + width = + viewportSize.width - + state.layoutInfo.beforeContentPadding - + state.layoutInfo.afterContentPadding, + height = viewportSize.height, + ), + ) + + val itemInfo = state.layoutInfo.visibleItemsInfo.find { it.index == index } + return if (itemInfo != null) { + val boundingBox = IntRect(itemInfo.offset, itemInfo.size) + boundingBox.percentOverlap(visibleRect) + } else { + 0f + } +} + private object Colors { val DisabledColorFilter by lazy { disabledColorMatrix() } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResponsiveLazyHorizontalGrid.kt b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResponsiveLazyHorizontalGrid.kt index 21b34748a364..c7930549abe8 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResponsiveLazyHorizontalGrid.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/communal/ui/compose/ResponsiveLazyHorizontalGrid.kt @@ -36,7 +36,9 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.graphics.toComposeRect import androidx.compose.ui.platform.LocalConfiguration +import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.unit.Dp @@ -45,6 +47,7 @@ import androidx.compose.ui.unit.IntSize import androidx.compose.ui.unit.coerceAtMost import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.times +import androidx.window.layout.WindowMetricsCalculator /** * Renders a responsive [LazyHorizontalGrid] with dynamic columns and rows. Each cell will maintain @@ -71,7 +74,7 @@ fun ResponsiveLazyHorizontalGrid( "$minHorizontalArrangement and $minVerticalArrangement, respectively." } BoxWithConstraints(modifier) { - val gridSize = rememberGridSize(maxWidth = maxWidth, maxHeight = maxHeight) + val gridSize = rememberGridSize() val layoutDirection = LocalLayoutDirection.current val density = LocalDensity.current @@ -128,25 +131,43 @@ fun ResponsiveLazyHorizontalGrid( val extraWidth = maxWidth - usedWidth val extraHeight = maxHeight - usedHeight - val finalStartPadding = minStartPadding + extraWidth / 2 + // If there is a single column or single row, distribute extra space evenly across the grid. + // Otherwise, distribute it along the content padding to center the content. + val distributeHorizontalSpaceAlongGutters = gridSize.height == 1 || gridSize.width == 1 + val evenlyDistributedWidth = + if (distributeHorizontalSpaceAlongGutters) { + extraWidth / (gridSize.width + 1) + } else { + extraWidth / 2 + } + + val finalStartPadding = minStartPadding + evenlyDistributedWidth + val finalEndPadding = minEndPadding + evenlyDistributedWidth val finalTopPadding = minTopPadding + extraHeight / 2 val finalContentPadding = PaddingValues( start = finalStartPadding, - end = minEndPadding + extraWidth / 2, + end = finalEndPadding, top = finalTopPadding, bottom = minBottomPadding + extraHeight / 2, ) with(density) { setContentOffset(Offset(finalStartPadding.toPx(), finalTopPadding.toPx())) } + val horizontalArrangement = + if (distributeHorizontalSpaceAlongGutters) { + minHorizontalArrangement + evenlyDistributedWidth + } else { + minHorizontalArrangement + } + LazyHorizontalGrid( rows = GridCells.Fixed(gridSize.height), modifier = Modifier.fillMaxSize(), state = state, contentPadding = finalContentPadding, - horizontalArrangement = Arrangement.spacedBy(minHorizontalArrangement), + horizontalArrangement = Arrangement.spacedBy(horizontalArrangement), verticalArrangement = Arrangement.spacedBy(minVerticalArrangement), flingBehavior = flingBehavior, userScrollEnabled = userScrollEnabled, @@ -210,27 +231,38 @@ data class SizeInfo( } @Composable -private fun rememberGridSize(maxWidth: Dp, maxHeight: Dp): IntSize { +private fun rememberGridSize(): IntSize { val configuration = LocalConfiguration.current val orientation = configuration.orientation + val screenSize = calculateWindowSize() - return remember(orientation, maxWidth, maxHeight) { + return remember(orientation, screenSize) { if (orientation == Configuration.ORIENTATION_PORTRAIT) { IntSize( - width = calculateNumCellsWidth(maxWidth), - height = calculateNumCellsHeight(maxHeight), + width = calculateNumCellsWidth(screenSize.width), + height = calculateNumCellsHeight(screenSize.height), ) } else { // In landscape we invert the rows/columns to ensure we match the same area as portrait. // This keeps the number of elements in the grid consistent when changing orientation. IntSize( - width = calculateNumCellsHeight(maxWidth), - height = calculateNumCellsWidth(maxHeight), + width = calculateNumCellsHeight(screenSize.width), + height = calculateNumCellsWidth(screenSize.height), ) } } } +@Composable +fun calculateWindowSize(): DpSize { + // Observe view configuration changes and recalculate the size class on each change. + LocalConfiguration.current + val density = LocalDensity.current + val context = LocalContext.current + val metrics = WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(context) + return with(density) { metrics.bounds.toComposeRect().size.toDpSize() } +} + private fun calculateNumCellsWidth(width: Dp) = // See https://developer.android.com/develop/ui/views/layout/use-window-size-classes when { diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt index ca1413e48966..b19645fadbdf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorTest.kt @@ -30,11 +30,13 @@ import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.useUnconfinedTestDispatcher import com.android.systemui.statusbar.StatusBarIconView +import com.android.systemui.statusbar.data.repository.fakeStatusBarModeRepository import com.android.systemui.statusbar.notification.data.model.activeNotificationModel import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository import com.android.systemui.statusbar.notification.shared.CallType import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel +import com.android.systemui.statusbar.window.fakeStatusBarWindowControllerStore import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest @@ -72,7 +74,7 @@ class OngoingCallInteractorTest : SysuiTestCase() { whenTime = 1000L, callType = CallType.Ongoing, statusBarChipIcon = testIconView, - contentIntent = testIntent + contentIntent = testIntent, ) ) } @@ -95,7 +97,9 @@ class OngoingCallInteractorTest : SysuiTestCase() { .apply { addIndividualNotif( activeNotificationModel( - key = "notif1", whenTime = 1000L, callType = CallType.Ongoing + key = "notif1", + whenTime = 1000L, + callType = CallType.Ongoing, ) ) } @@ -114,7 +118,9 @@ class OngoingCallInteractorTest : SysuiTestCase() { .apply { addIndividualNotif( activeNotificationModel( - key = "notif1", whenTime = 1000L, callType = CallType.Ongoing + key = "notif1", + whenTime = 1000L, + callType = CallType.Ongoing, ) ) } @@ -138,7 +144,7 @@ class OngoingCallInteractorTest : SysuiTestCase() { key = "notif1", whenTime = 1000L, callType = CallType.Ongoing, - uid = UID + uid = UID, ) ) } @@ -161,7 +167,7 @@ class OngoingCallInteractorTest : SysuiTestCase() { key = "notif1", whenTime = 1000L, callType = CallType.Ongoing, - uid = UID + uid = UID, ) ) } @@ -185,13 +191,12 @@ class OngoingCallInteractorTest : SysuiTestCase() { key = "notif1", whenTime = 1000L, callType = CallType.Ongoing, - uid = UID + uid = UID, ) ) } .build() - assertThat(latest) - .isInstanceOf(OngoingCallModel.InCall::class.java) + assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) // App becomes visible kosmos.activityManagerRepository.fake.setIsAppVisible(UID, true) @@ -202,6 +207,120 @@ class OngoingCallInteractorTest : SysuiTestCase() { assertThat(latest).isInstanceOf(OngoingCallModel.InCall::class.java) } + @Test + fun ongoingCallNotification_setsRequiresStatusBarVisibleTrue() = + kosmos.runTest { + val ongoingCallState by collectLastValue(underTest.ongoingCallState) + + val requiresStatusBarVisibleInRepository by + collectLastValue( + kosmos.fakeStatusBarModeRepository.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + val requiresStatusBarVisibleInWindowController by + collectLastValue( + kosmos.fakeStatusBarWindowControllerStore.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + repository.activeNotifications.value = + ActiveNotificationsStore.Builder() + .apply { + addIndividualNotif( + activeNotificationModel( + key = "notif1", + whenTime = 1000L, + callType = CallType.Ongoing, + uid = UID, + ) + ) + } + .build() + + assertThat(ongoingCallState).isInstanceOf(OngoingCallModel.InCall::class.java) + assertThat(requiresStatusBarVisibleInRepository).isTrue() + assertThat(requiresStatusBarVisibleInWindowController).isTrue() + } + + @Test + fun notificationRemoved_setsRequiresStatusBarVisibleFalse() = + kosmos.runTest { + val ongoingCallState by collectLastValue(underTest.ongoingCallState) + + val requiresStatusBarVisibleInRepository by + collectLastValue( + kosmos.fakeStatusBarModeRepository.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + val requiresStatusBarVisibleInWindowController by + collectLastValue( + kosmos.fakeStatusBarWindowControllerStore.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + + repository.activeNotifications.value = + ActiveNotificationsStore.Builder() + .apply { + addIndividualNotif( + activeNotificationModel( + key = "notif1", + whenTime = 1000L, + callType = CallType.Ongoing, + uid = UID, + ) + ) + } + .build() + + repository.activeNotifications.value = ActiveNotificationsStore() + + assertThat(ongoingCallState).isInstanceOf(OngoingCallModel.NoCall::class.java) + assertThat(requiresStatusBarVisibleInRepository).isFalse() + assertThat(requiresStatusBarVisibleInWindowController).isFalse() + } + + @Test + fun ongoingCallNotification_appBecomesVisible_setsRequiresStatusBarVisibleFalse() = + kosmos.runTest { + val ongoingCallState by collectLastValue(underTest.ongoingCallState) + + val requiresStatusBarVisibleInRepository by + collectLastValue( + kosmos.fakeStatusBarModeRepository.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + val requiresStatusBarVisibleInWindowController by + collectLastValue( + kosmos.fakeStatusBarWindowControllerStore.defaultDisplay + .ongoingProcessRequiresStatusBarVisible + ) + + kosmos.activityManagerRepository.fake.startingIsAppVisibleValue = false + repository.activeNotifications.value = + ActiveNotificationsStore.Builder() + .apply { + addIndividualNotif( + activeNotificationModel( + key = "notif1", + whenTime = 1000L, + callType = CallType.Ongoing, + uid = UID, + ) + ) + } + .build() + + assertThat(ongoingCallState).isInstanceOf(OngoingCallModel.InCall::class.java) + assertThat(requiresStatusBarVisibleInRepository).isTrue() + assertThat(requiresStatusBarVisibleInWindowController).isTrue() + + kosmos.activityManagerRepository.fake.setIsAppVisible(UID, true) + + assertThat(ongoingCallState) + .isInstanceOf(OngoingCallModel.InCallWithVisibleApp::class.java) + assertThat(requiresStatusBarVisibleInRepository).isFalse() + assertThat(requiresStatusBarVisibleInWindowController).isFalse() + } + companion object { private const val UID = 885 } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt index 038722cd9608..bf1fbad074cd 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModelTest.kt @@ -20,8 +20,6 @@ import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.android.settingslib.AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH -import com.android.settingslib.AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH_NONE import com.android.settingslib.mobile.MobileMappings import com.android.settingslib.mobile.TelephonyIcons.G import com.android.settingslib.mobile.TelephonyIcons.THREE_G @@ -40,12 +38,15 @@ import com.android.systemui.statusbar.connectivity.MobileIconCarrierIdOverridesF import com.android.systemui.statusbar.pipeline.airplane.data.repository.FakeAirplaneModeRepository import com.android.systemui.statusbar.pipeline.airplane.domain.interactor.AirplaneModeInteractor import com.android.systemui.statusbar.pipeline.mobile.data.model.DataConnectionState +import com.android.systemui.statusbar.pipeline.mobile.data.model.NetworkNameModel import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionRepository +import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionRepository.Companion.DEFAULT_NETWORK_NAME import com.android.systemui.statusbar.pipeline.mobile.data.repository.FakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.data.repository.fakeMobileConnectionsRepository import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconInteractorImpl import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractorImpl import com.android.systemui.statusbar.pipeline.mobile.domain.model.SignalIconModel +import com.android.systemui.statusbar.pipeline.mobile.ui.model.MobileContentDescription import com.android.systemui.statusbar.pipeline.mobile.util.FakeMobileMappingsProxy import com.android.systemui.statusbar.pipeline.shared.ConnectivityConstants import com.android.systemui.statusbar.pipeline.shared.data.model.ConnectivitySlot @@ -255,59 +256,146 @@ class MobileIconViewModelTest : SysuiTestCase() { @Test fun contentDescription_notInService_usesNoPhone() = testScope.runTest { - var latest: ContentDescription? = null - val job = underTest.contentDescription.onEach { latest = it }.launchIn(this) + val latest by collectLastValue(underTest.contentDescription) repository.isInService.value = false - assertThat((latest as ContentDescription.Resource).res) - .isEqualTo(PHONE_SIGNAL_STRENGTH_NONE) + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) + } - job.cancel() + @Test + fun contentDescription_includesNetworkName() = + testScope.runTest { + val latest by collectLastValue(underTest.contentDescription) + + repository.isInService.value = true + repository.networkName.value = NetworkNameModel.SubscriptionDerived("Test Network Name") + repository.numberOfLevels.value = 5 + repository.setAllLevels(3) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular("Test Network Name", THREE_BARS)) } @Test fun contentDescription_inService_usesLevel() = testScope.runTest { - var latest: ContentDescription? = null - val job = underTest.contentDescription.onEach { latest = it }.launchIn(this) + val latest by collectLastValue(underTest.contentDescription) repository.setAllLevels(2) - assertThat((latest as ContentDescription.Resource).res) - .isEqualTo(PHONE_SIGNAL_STRENGTH[2]) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, TWO_BARS)) repository.setAllLevels(0) - assertThat((latest as ContentDescription.Resource).res) - .isEqualTo(PHONE_SIGNAL_STRENGTH[0]) - job.cancel() + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) } @Test - fun contentDescription_nonInflated_invalidLevelIsNull() = + fun contentDescription_nonInflated_invalidLevelUsesNoSignalText() = testScope.runTest { val latest by collectLastValue(underTest.contentDescription) repository.inflateSignalStrength.value = false repository.setAllLevels(-1) - assertThat(latest).isNull() + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) repository.setAllLevels(100) - assertThat(latest).isNull() + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) + } + + @Test + fun contentDescription_nonInflated_levelStrings() = + testScope.runTest { + val latest by collectLastValue(underTest.contentDescription) + + repository.inflateSignalStrength.value = false + repository.setAllLevels(0) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) + + repository.setAllLevels(1) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, ONE_BAR)) + + repository.setAllLevels(2) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, TWO_BARS)) + + repository.setAllLevels(3) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, THREE_BARS)) + + repository.setAllLevels(4) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, FULL_BARS)) } @Test - fun contentDescription_inflated_invalidLevelIsNull() = + fun contentDescription_inflated_invalidLevelUsesNoSignalText() = testScope.runTest { val latest by collectLastValue(underTest.contentDescription) repository.inflateSignalStrength.value = true repository.numberOfLevels.value = 6 + repository.setAllLevels(-2) - assertThat(latest).isNull() + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) repository.setAllLevels(100) - assertThat(latest).isNull() + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, NO_SIGNAL)) + } + + @Test + fun contentDescription_inflated_levelStrings() = + testScope.runTest { + val latest by collectLastValue(underTest.contentDescription) + + repository.inflateSignalStrength.value = true + repository.numberOfLevels.value = 6 + + // Note that the _repo_ level is 1 lower than the reported level through the interactor + + repository.setAllLevels(0) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, ONE_BAR)) + + repository.setAllLevels(1) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, TWO_BARS)) + + repository.setAllLevels(2) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, THREE_BARS)) + + repository.setAllLevels(3) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, FOUR_BARS)) + + repository.setAllLevels(4) + + assertThat(latest as MobileContentDescription.Cellular) + .isEqualTo(MobileContentDescription.Cellular(DEFAULT_NETWORK_NAME, FULL_BARS)) } @Test @@ -323,7 +411,10 @@ class MobileIconViewModelTest : SysuiTestCase() { repository.setAllLevels(i) when (i) { -1, - 5 -> assertWithMessage("Level $i is expected to be null").that(latest).isNull() + 5 -> + assertWithMessage("Level $i is expected to be 'no signal'") + .that((latest as MobileContentDescription.Cellular).levelDescriptionRes) + .isEqualTo(NO_SIGNAL) else -> assertWithMessage("Level $i is expected not to be null") .that(latest) @@ -344,7 +435,10 @@ class MobileIconViewModelTest : SysuiTestCase() { repository.setAllLevels(i) when (i) { -2, - 5 -> assertWithMessage("Level $i is expected to be null").that(latest).isNull() + 5 -> + assertWithMessage("Level $i is expected to be 'no signal'") + .that((latest as MobileContentDescription.Cellular).levelDescriptionRes) + .isEqualTo(NO_SIGNAL) else -> assertWithMessage("Level $i is not expected to be null") .that(latest) @@ -967,5 +1061,13 @@ class MobileIconViewModelTest : SysuiTestCase() { companion object { private const val SUB_1_ID = 1 + + // For convenience, just define these as constants + private val NO_SIGNAL = R.string.accessibility_no_signal + private val ONE_BAR = R.string.accessibility_one_bar + private val TWO_BARS = R.string.accessibility_two_bars + private val THREE_BARS = R.string.accessibility_three_bars + private val FOUR_BARS = R.string.accessibility_four_bars + private val FULL_BARS = R.string.accessibility_signal_full } } diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 05c13f20f6d2..ff459e92ca28 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1950,6 +1950,21 @@ <!-- Text displayed indicating that the user might be able to use satellite SOS. --> <string name="satellite_emergency_only_carrier_text">Emergency calls or SOS</string> + <!-- Content description skeleton. Input strings should be carrier name and signal bar description [CHAR LIMIT=NONE]--> + <string name="accessibility_phone_string_format"><xliff:g id="carrier_name" example="Carrier Name">%1$s</xliff:g>, <xliff:g id="signal_strength_description" example="two bars">%2$s</xliff:g>.</string> + <!-- Content description describing 0 signal bars. [CHAR LIMIT=NONE] --> + <string name="accessibility_no_signal">no signal</string> + <!-- Content description describing 1 signal bar. [CHAR LIMIT=NONE] --> + <string name="accessibility_one_bar">one bar</string> + <!-- Content description describing 2 signal bars. [CHAR LIMIT=NONE] --> + <string name="accessibility_two_bars">two bars</string> + <!-- Content description describing 3 signal bars. [CHAR LIMIT=NONE] --> + <string name="accessibility_three_bars">three bars</string> + <!-- Content description describing 4 signal bars. [CHAR LIMIT=NONE] --> + <string name="accessibility_four_bars">four bars</string> + <!-- Content description describing full signal bars. [CHAR LIMIT=NONE] --> + <string name="accessibility_signal_full">signal full</string> + <!-- Accessibility label for managed profile icon (not shown on screen) [CHAR LIMIT=NONE] --> <string name="accessibility_managed_profile">Work profile</string> diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java index 4fb96e72d8df..ec8d30b01eab 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/ScreenRecordTile.java @@ -24,6 +24,7 @@ import android.os.Looper; import android.service.quicksettings.Tile; import android.text.TextUtils; import android.util.Log; +import android.widget.Button; import android.widget.Switch; import androidx.annotation.Nullable; @@ -144,8 +145,10 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState> // Show expand icon when clicking will open a dialog state.forceExpandIcon = state.state == Tile.STATE_INACTIVE; + state.expandedAccessibilityClassName = Button.class.getName(); if (isRecording) { state.secondaryLabel = mContext.getString(R.string.quick_settings_screen_record_stop); + state.expandedAccessibilityClassName = Switch.class.getName(); } else if (isStarting) { int countdown = (int) ScreenRecordModel.Starting.Companion.toCountdownSeconds( @@ -157,7 +160,6 @@ public class ScreenRecordTile extends QSTileImpl<QSTile.BooleanState> state.contentDescription = TextUtils.isEmpty(state.secondaryLabel) ? state.label : TextUtils.concat(state.label, ", ", state.secondaryLabel); - state.expandedAccessibilityClassName = Switch.class.getName(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java index d0dc7ac386c5..2544323d83d5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java @@ -20,7 +20,6 @@ import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; import static com.android.systemui.Flags.fetchBookmarksXmlKeyboardShortcuts; -import static com.android.systemui.Flags.validateKeyboardShortcutHelperIconUri; import android.annotation.NonNull; import android.annotation.Nullable; @@ -427,9 +426,7 @@ public final class KeyboardShortcutListSearch { mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, false); } else { mCurrentAppPackageName = result.get(0).getPackageName(); - if (validateKeyboardShortcutHelperIconUri()) { - KeyboardShortcuts.sanitiseShortcuts(result); - } + KeyboardShortcuts.sanitiseShortcuts(result); mSpecificAppGroup.addAll( reMapToKeyboardShortcutMultiMappingGroup(result)); mKeySearchResultMap.put(SHORTCUT_SPECIFICAPP_INDEX, true); @@ -445,9 +442,7 @@ public final class KeyboardShortcutListSearch { // Add specific Ime shortcuts if (result != null) { if (!result.isEmpty()) { - if (validateKeyboardShortcutHelperIconUri()) { - KeyboardShortcuts.sanitiseShortcuts(result); - } + KeyboardShortcuts.sanitiseShortcuts(result); mInputGroup.addAll( reMapToKeyboardShortcutMultiMappingGroup(result)); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java index 766c391b14d8..2ed168aa82e8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java @@ -21,7 +21,6 @@ import static android.view.View.IMPORTANT_FOR_ACCESSIBILITY_YES; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; import static com.android.systemui.Flags.fetchBookmarksXmlKeyboardShortcuts; -import static com.android.systemui.Flags.validateKeyboardShortcutHelperIconUri; import android.annotation.NonNull; import android.annotation.Nullable; @@ -412,10 +411,7 @@ public final class KeyboardShortcuts { mReceivedAppShortcutGroups = result == null ? Collections.emptyList() : result; - if (validateKeyboardShortcutHelperIconUri()) { - sanitiseShortcuts(mReceivedAppShortcutGroups); - } - + sanitiseShortcuts(mReceivedAppShortcutGroups); maybeMergeAndShowKeyboardShortcuts(); } @@ -423,10 +419,7 @@ public final class KeyboardShortcuts { mReceivedImeShortcutGroups = result == null ? Collections.emptyList() : result; - if (validateKeyboardShortcutHelperIconUri()) { - sanitiseShortcuts(mReceivedImeShortcutGroups); - } - + sanitiseShortcuts(mReceivedImeShortcutGroups); maybeMergeAndShowKeyboardShortcuts(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModePerDisplayRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModePerDisplayRepository.kt index cc91e2dc3a25..22c37df7db7e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModePerDisplayRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/StatusBarModePerDisplayRepository.kt @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.phone.BoundsPair import com.android.systemui.statusbar.phone.LetterboxAppearanceCalculator import com.android.systemui.statusbar.phone.StatusBarBoundsProvider import com.android.systemui.statusbar.phone.fragment.dagger.HomeStatusBarComponent +import com.android.systemui.statusbar.phone.ongoingcall.StatusBarChipsModernization import com.android.systemui.statusbar.phone.ongoingcall.data.repository.OngoingCallRepository import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import dagger.assisted.Assisted @@ -89,6 +90,9 @@ interface StatusBarModePerDisplayRepository : OnStatusBarViewInitializedListener /** The current mode of the status bar. */ val statusBarMode: StateFlow<StatusBarMode> + /** Whether the status bar is forced to be visible because of an ongoing call */ + val ongoingProcessRequiresStatusBarVisible: StateFlow<Boolean> + /** * Requests for the status bar to be shown transiently. * @@ -110,6 +114,12 @@ interface StatusBarModePerDisplayRepository : OnStatusBarViewInitializedListener * if needed. */ fun stop() + + /** + * Called when an ongoing process needs to prevent the status bar from being hidden in any + * state. + */ + fun setOngoingProcessRequiresStatusBarVisible(requiredVisible: Boolean) } class StatusBarModePerDisplayRepositoryImpl @@ -195,6 +205,16 @@ constructor( statusBarBoundsProvider.addChangeListener(listener) } + private val _ongoingProcessRequiresStatusBarVisible = MutableStateFlow(false) + override val ongoingProcessRequiresStatusBarVisible = + _ongoingProcessRequiresStatusBarVisible.asStateFlow() + + override fun setOngoingProcessRequiresStatusBarVisible( + requiredVisible: Boolean + ) { + _ongoingProcessRequiresStatusBarVisible.value = requiredVisible + } + override val isInFullscreenMode: StateFlow<Boolean> = _originalStatusBarAttributes .map { params -> @@ -235,16 +255,28 @@ constructor( isTransientShown, isInFullscreenMode, ongoingCallRepository.ongoingCallState, - ) { modifiedAttributes, isTransientShown, isInFullscreenMode, ongoingCallState -> + _ongoingProcessRequiresStatusBarVisible, + ) { + modifiedAttributes, + isTransientShown, + isInFullscreenMode, + ongoingCallStateLegacy, + ongoingProcessRequiresStatusBarVisible -> if (modifiedAttributes == null) { null } else { + val hasOngoingCall = + if (StatusBarChipsModernization.isEnabled) { + ongoingProcessRequiresStatusBarVisible + } else { + ongoingCallStateLegacy is OngoingCallModel.InCall + } val statusBarMode = toBarMode( modifiedAttributes.appearance, isTransientShown, isInFullscreenMode, - hasOngoingCall = ongoingCallState is OngoingCallModel.InCall, + hasOngoingCall, ) StatusBarAppearance( statusBarMode, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt index 4b71c0268f11..b7ccfa01c92c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractor.kt @@ -21,17 +21,22 @@ import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.Logger +import com.android.systemui.statusbar.data.repository.StatusBarModeRepositoryStore import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor +import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel import com.android.systemui.statusbar.phone.ongoingcall.OngoingCallLog import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel +import com.android.systemui.statusbar.window.StatusBarWindowControllerStore import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.flatMapLatest import kotlinx.coroutines.flow.flowOf +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn /** @@ -47,7 +52,9 @@ import kotlinx.coroutines.flow.stateIn @SysUISingleton class OngoingCallInteractor @Inject constructor( @Application private val scope: CoroutineScope, - activityManagerRepository: ActivityManagerRepository, + private val activityManagerRepository: ActivityManagerRepository, + private val statusBarModeRepositoryStore: StatusBarModeRepositoryStore, + private val statusBarWindowControllerStore: StatusBarWindowControllerStore, activeNotificationsInteractor: ActiveNotificationsInteractor, @OngoingCallLog private val logBuffer: LogBuffer, ) { @@ -58,46 +65,78 @@ class OngoingCallInteractor @Inject constructor( */ val ongoingCallState: StateFlow<OngoingCallModel> = activeNotificationsInteractor.ongoingCallNotification - .flatMapLatest { notificationModel -> - when (notificationModel) { - null -> { - logger.d("No active call notification - hiding chip") - flowOf(OngoingCallModel.NoCall) - } + .flatMapLatest { notification -> + createOngoingCallStateFlow( + notification = notification + ) + } + .onEach { state -> + setStatusBarRequiredForOngoingCall(state) + } + .stateIn( + scope = scope, + started = SharingStarted.WhileSubscribed(), + initialValue = OngoingCallModel.NoCall + ) + + private fun createOngoingCallStateFlow( + notification: ActiveNotificationModel? + ): Flow<OngoingCallModel> { + if (notification == null) { + logger.d("No active call notification - hiding chip") + return flowOf(OngoingCallModel.NoCall) + } + + return combine( + flowOf(notification), + activityManagerRepository.createIsAppVisibleFlow( + creationUid = notification.uid, + logger = logger, + identifyingLogTag = TAG, + ) + ) { model, isVisible -> + deriveOngoingCallState(model, isVisible) + } + } - else -> combine( - flowOf(notificationModel), - activityManagerRepository.createIsAppVisibleFlow( - creationUid = notificationModel.uid, - logger = logger, - identifyingLogTag = TAG, - ), - ) { model, isVisible -> - when { - isVisible -> { - logger.d({ "Call app is visible: uid=$int1" }) { - int1 = model.uid - } - OngoingCallModel.InCallWithVisibleApp - } + private fun deriveOngoingCallState( + model: ActiveNotificationModel, + isVisible: Boolean + ): OngoingCallModel { + return when { + isVisible -> { + logger.d({ "Call app is visible: uid=$int1" }) { + int1 = model.uid + } + OngoingCallModel.InCallWithVisibleApp + } - else -> { - logger.d({ "Active call detected: startTime=$long1 hasIcon=$bool1" }) { - long1 = model.whenTime - bool1 = model.statusBarChipIconView != null - } - OngoingCallModel.InCall( - startTimeMs = model.whenTime, - notificationIconView = model.statusBarChipIconView, - intent = model.contentIntent, - notificationKey = model.key, - ) - } - } - } + else -> { + logger.d({ "Active call detected: startTime=$long1 hasIcon=$bool1" }) { + long1 = model.whenTime + bool1 = model.statusBarChipIconView != null } + OngoingCallModel.InCall( + startTimeMs = model.whenTime, + notificationIconView = model.statusBarChipIconView, + intent = model.contentIntent, + notificationKey = model.key + ) } - .stateIn(scope, SharingStarted.WhileSubscribed(), OngoingCallModel.NoCall) + } + } + + private fun setStatusBarRequiredForOngoingCall(state: OngoingCallModel) { + val statusBarRequired = state is OngoingCallModel.InCall + // TODO(b/382808183): Create a single repository that can be utilized in + // `statusBarModeRepositoryStore` and `statusBarWindowControllerStore` so we do not need + // two separate calls to force the status bar to stay visible. + statusBarModeRepositoryStore.defaultDisplay.setOngoingProcessRequiresStatusBarVisible( + statusBarRequired + ) + statusBarWindowControllerStore.defaultDisplay + .setOngoingProcessRequiresStatusBarVisible(statusBarRequired) + } companion object { private val TAG = "OngoingCall" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileContentDescriptionViewBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileContentDescriptionViewBinder.kt new file mode 100644 index 000000000000..c720b1df1e62 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileContentDescriptionViewBinder.kt @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.mobile.ui.binder + +import android.view.View +import com.android.systemui.statusbar.pipeline.mobile.ui.model.MobileContentDescription + +object MobileContentDescriptionViewBinder { + fun bind(contentDescription: MobileContentDescription?, view: View) { + view.contentDescription = + when (contentDescription) { + null -> null + else -> contentDescription.loadContentDescription(view.context) + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt index 31d349eb4cca..788f041b38c0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/binder/MobileIconBinder.kt @@ -29,9 +29,9 @@ import androidx.core.view.isVisible import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle +import com.android.app.tracing.coroutines.launchTraced as launch import com.android.settingslib.graph.SignalDrawable import com.android.systemui.Flags.statusBarStaticInoutIndicators -import com.android.systemui.common.ui.binder.ContentDescriptionViewBinder import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.DarkIconDispatcher @@ -48,12 +48,8 @@ import com.android.systemui.statusbar.pipeline.shared.ui.binder.StatusBarViewBin import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.distinctUntilChanged -import com.android.app.tracing.coroutines.launchTraced as launch -private data class Colors( - @ColorInt val tint: Int, - @ColorInt val contrast: Int, -) +private data class Colors(@ColorInt val tint: Int, @ColorInt val contrast: Int) object MobileIconBinder { /** Binds the view to the view-model, continuing to update the former based on the latter */ @@ -87,7 +83,7 @@ object MobileIconBinder { MutableStateFlow( Colors( tint = DarkIconDispatcher.DEFAULT_ICON_TINT, - contrast = DarkIconDispatcher.DEFAULT_INVERSE_ICON_TINT + contrast = DarkIconDispatcher.DEFAULT_INVERSE_ICON_TINT, ) ) val decorTint: MutableStateFlow<Int> = MutableStateFlow(viewModel.defaultColor) @@ -105,7 +101,7 @@ object MobileIconBinder { viewModel.verboseLogger?.logBinderReceivedVisibility( view, viewModel.subscriptionId, - isVisible + isVisible, ) view.isVisible = isVisible // [StatusIconContainer] can get out of sync sometimes. Make sure to @@ -152,7 +148,7 @@ object MobileIconBinder { launch { viewModel.contentDescription.distinctUntilChanged().collect { - ContentDescriptionViewBinder.bind(it, view) + MobileContentDescriptionViewBinder.bind(it, view) } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/MobileContentDescription.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/MobileContentDescription.kt new file mode 100644 index 000000000000..84fa07379a49 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/model/MobileContentDescription.kt @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.statusbar.pipeline.mobile.ui.model + +import android.annotation.StringRes +import android.content.Context +import com.android.systemui.res.R + +sealed interface MobileContentDescription { + fun loadContentDescription(context: Context): String + + /** + * Content description for cellular parameterizes the [networkName] which comes from the system + */ + data class Cellular(val networkName: String, @StringRes val levelDescriptionRes: Int) : + MobileContentDescription { + override fun loadContentDescription(context: Context): String = + context.getString( + R.string.accessibility_phone_string_format, + networkName, + context.getString(levelDescriptionRes), + ) + } + + data class SatelliteContentDescription(@StringRes val resId: Int) : MobileContentDescription { + override fun loadContentDescription(context: Context): String = + context.getString(this.resId) + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt index 103b0e3a6f27..0bd3426712bd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/mobile/ui/viewmodel/MobileIconViewModel.kt @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel -import com.android.settingslib.AccessibilityContentDescriptions import com.android.systemui.Flags.statusBarStaticInoutIndicators import com.android.systemui.common.shared.model.ContentDescription import com.android.systemui.common.shared.model.Icon @@ -28,6 +27,7 @@ import com.android.systemui.statusbar.pipeline.airplane.domain.interactor.Airpla import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconInteractor import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.MobileIconsInteractor import com.android.systemui.statusbar.pipeline.mobile.domain.model.SignalIconModel +import com.android.systemui.statusbar.pipeline.mobile.ui.model.MobileContentDescription import com.android.systemui.statusbar.pipeline.shared.ConnectivityConstants import com.android.systemui.statusbar.pipeline.shared.data.model.DataActivityModel import kotlinx.coroutines.CoroutineScope @@ -50,7 +50,7 @@ interface MobileIconViewModelCommon { /** True if this view should be visible at all. */ val isVisible: StateFlow<Boolean> val icon: Flow<SignalIconModel> - val contentDescription: Flow<ContentDescription?> + val contentDescription: Flow<MobileContentDescription?> val roaming: Flow<Boolean> /** The RAT icon (LTE, 3G, 5G, etc) to be displayed. Null if we shouldn't show anything */ val networkTypeIcon: Flow<Icon.Resource?> @@ -95,10 +95,7 @@ class MobileIconViewModel( } private val satelliteProvider by lazy { - CarrierBasedSatelliteViewModelImpl( - subscriptionId, - iconInteractor, - ) + CarrierBasedSatelliteViewModelImpl(subscriptionId, iconInteractor) } /** @@ -123,7 +120,7 @@ class MobileIconViewModel( override val icon: Flow<SignalIconModel> = vmProvider.flatMapLatest { it.icon } - override val contentDescription: Flow<ContentDescription?> = + override val contentDescription: Flow<MobileContentDescription?> = vmProvider.flatMapLatest { it.contentDescription } override val roaming: Flow<Boolean> = vmProvider.flatMapLatest { it.roaming } @@ -154,8 +151,7 @@ private class CarrierBasedSatelliteViewModelImpl( override val isVisible: StateFlow<Boolean> = MutableStateFlow(true) override val icon: Flow<SignalIconModel> = interactor.signalLevelIcon - override val contentDescription: Flow<ContentDescription> = - MutableStateFlow(ContentDescription.Loaded("")) + override val contentDescription: Flow<MobileContentDescription?> = MutableStateFlow(null) /** These fields are not used for satellite icons currently */ override val roaming: Flow<Boolean> = flowOf(false) @@ -206,27 +202,42 @@ private class CellularIconViewModel( override val icon: Flow<SignalIconModel> = iconInteractor.signalLevelIcon - override val contentDescription: Flow<ContentDescription?> = - iconInteractor.signalLevelIcon - .map { - // We expect the signal icon to be cellular here since this is the cellular vm - if (it !is SignalIconModel.Cellular) { - null - } else { - val resId = - AccessibilityContentDescriptions.getDescriptionForLevel( - it.level, - it.numberOfLevels + override val contentDescription: Flow<MobileContentDescription?> = + combine(iconInteractor.signalLevelIcon, iconInteractor.networkName) { icon, nameModel -> + when (icon) { + is SignalIconModel.Cellular -> + MobileContentDescription.Cellular( + nameModel.name, + icon.levelDescriptionRes(), ) - if (resId != 0) { - ContentDescription.Resource(resId) - } else { - null - } + else -> null } } .stateIn(scope, SharingStarted.WhileSubscribed(), null) + private fun SignalIconModel.Cellular.levelDescriptionRes() = + when (level) { + 0 -> R.string.accessibility_no_signal + 1 -> R.string.accessibility_one_bar + 2 -> R.string.accessibility_two_bars + 3 -> R.string.accessibility_three_bars + 4 -> { + if (numberOfLevels == 6) { + R.string.accessibility_four_bars + } else { + R.string.accessibility_signal_full + } + } + 5 -> { + if (numberOfLevels == 6) { + R.string.accessibility_signal_full + } else { + R.string.accessibility_no_signal + } + } + else -> R.string.accessibility_no_signal + } + private val showNetworkTypeIcon: Flow<Boolean> = combine( iconInteractor.isDataConnected, @@ -248,10 +259,9 @@ private class CellularIconViewModel( .stateIn(scope, SharingStarted.WhileSubscribed(), false) override val networkTypeIcon: Flow<Icon.Resource?> = - combine( - iconInteractor.networkTypeIconGroup, - showNetworkTypeIcon, - ) { networkTypeIconGroup, shouldShow -> + combine(iconInteractor.networkTypeIconGroup, showNetworkTypeIcon) { + networkTypeIconGroup, + shouldShow -> val desc = if (networkTypeIconGroup.contentDescription != 0) ContentDescription.Resource(networkTypeIconGroup.contentDescription) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutListSearchTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutListSearchTest.java index 63e56eeb730f..8045a13ff9be 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutListSearchTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutListSearchTest.java @@ -26,7 +26,6 @@ import static org.mockito.Mockito.when; import android.graphics.drawable.Icon; import android.os.Handler; -import android.platform.test.annotations.EnableFlags; import android.view.KeyboardShortcutGroup; import android.view.KeyboardShortcutInfo; import android.view.WindowManager; @@ -34,7 +33,6 @@ import android.view.WindowManager; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; -import com.android.systemui.Flags; import com.android.systemui.SysuiTestCase; import com.google.android.material.bottomsheet.BottomSheetDialog; @@ -95,7 +93,6 @@ public class KeyboardShortcutListSearchTest extends SysuiTestCase { } @Test - @EnableFlags(Flags.FLAG_VALIDATE_KEYBOARD_SHORTCUT_HELPER_ICON_URI) public void requestAppKeyboardShortcuts_callback_sanitisesIcons() { KeyboardShortcutGroup group = createKeyboardShortcutGroupForIconTests(); @@ -114,7 +111,6 @@ public class KeyboardShortcutListSearchTest extends SysuiTestCase { } @Test - @EnableFlags(Flags.FLAG_VALIDATE_KEYBOARD_SHORTCUT_HELPER_ICON_URI) public void requestImeKeyboardShortcuts_callback_sanitisesIcons() { KeyboardShortcutGroup group = createKeyboardShortcutGroupForIconTests(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutsTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutsTest.java index 105cf168995c..20ecaf75c625 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutsTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyboardShortcutsTest.java @@ -31,7 +31,6 @@ import android.annotation.Nullable; import android.app.Dialog; import android.graphics.drawable.Icon; import android.os.Handler; -import android.platform.test.annotations.EnableFlags; import android.view.KeyboardShortcutGroup; import android.view.KeyboardShortcutInfo; import android.view.WindowManager; @@ -39,7 +38,6 @@ import android.view.WindowManager; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; -import com.android.systemui.Flags; import com.android.systemui.SysuiTestCase; import org.junit.Before; @@ -131,7 +129,6 @@ public class KeyboardShortcutsTest extends SysuiTestCase { } @Test - @EnableFlags(Flags.FLAG_VALIDATE_KEYBOARD_SHORTCUT_HELPER_ICON_URI) public void requestAppKeyboardShortcuts_callback_sanitisesIcons() { KeyboardShortcutGroup group = createKeyboardShortcutGroupForIconTests(); KeyboardShortcuts.toggle(mContext, DEVICE_ID); @@ -143,7 +140,6 @@ public class KeyboardShortcutsTest extends SysuiTestCase { } @Test - @EnableFlags(Flags.FLAG_VALIDATE_KEYBOARD_SHORTCUT_HELPER_ICON_URI) public void requestImeKeyboardShortcuts_callback_sanitisesIcons() { KeyboardShortcutGroup group = createKeyboardShortcutGroupForIconTests(); KeyboardShortcuts.toggle(mContext, DEVICE_ID); diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/data/repository/FakeStatusBarModeRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/data/repository/FakeStatusBarModeRepository.kt index 22f8767e1d55..3c2d004fcad7 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/data/repository/FakeStatusBarModeRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/data/repository/FakeStatusBarModeRepository.kt @@ -47,6 +47,7 @@ class FakeStatusBarModePerDisplayRepository : StatusBarModePerDisplayRepository override val isInFullscreenMode = MutableStateFlow(false) override val statusBarAppearance = MutableStateFlow<StatusBarAppearance?>(null) override val statusBarMode = MutableStateFlow(StatusBarMode.TRANSPARENT) + override val ongoingProcessRequiresStatusBarVisible = MutableStateFlow(false) override fun showTransient() { isTransientShown.value = true @@ -59,6 +60,9 @@ class FakeStatusBarModePerDisplayRepository : StatusBarModePerDisplayRepository override fun start() {} override fun stop() {} + override fun setOngoingProcessRequiresStatusBarVisible(requiredVisible: Boolean) { + ongoingProcessRequiresStatusBarVisible.value = requiredVisible + } override fun onStatusBarViewInitialized(component: HomeStatusBarComponent) {} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorKosmos.kt index 51fb36fb2ead..9090e02b22b6 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/phone/ongoingcall/domain/interactor/OngoingCallInteractorKosmos.kt @@ -20,7 +20,9 @@ import com.android.systemui.activity.data.repository.activityManagerRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope import com.android.systemui.log.logcatLogBuffer +import com.android.systemui.statusbar.data.repository.fakeStatusBarModeRepository import com.android.systemui.statusbar.notification.domain.interactor.activeNotificationsInteractor +import com.android.systemui.statusbar.window.fakeStatusBarWindowControllerStore val Kosmos.ongoingCallInteractor: OngoingCallInteractor by Kosmos.Fixture { @@ -28,6 +30,8 @@ val Kosmos.ongoingCallInteractor: OngoingCallInteractor by scope = applicationCoroutineScope, activeNotificationsInteractor = activeNotificationsInteractor, activityManagerRepository = activityManagerRepository, + statusBarModeRepositoryStore = fakeStatusBarModeRepository, + statusBarWindowControllerStore = fakeStatusBarWindowControllerStore, logBuffer = logcatLogBuffer("OngoingCallInteractorKosmos"), ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/window/FakeStatusBarWindowController.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/window/FakeStatusBarWindowController.kt index a110a49ccba8..09e6a0eaa301 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/window/FakeStatusBarWindowController.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/window/FakeStatusBarWindowController.kt @@ -20,6 +20,7 @@ import android.view.View import android.view.ViewGroup import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.fragments.FragmentHostManager +import kotlinx.coroutines.flow.MutableStateFlow import java.util.Optional class FakeStatusBarWindowController : StatusBarWindowController { @@ -30,6 +31,8 @@ class FakeStatusBarWindowController : StatusBarWindowController { var isStopped = false private set + val ongoingProcessRequiresStatusBarVisible = MutableStateFlow(false) + override val statusBarHeight: Int = 0 override fun refreshStatusBarHeight() {} @@ -57,5 +60,7 @@ class FakeStatusBarWindowController : StatusBarWindowController { override fun setForceStatusBarVisible(forceStatusBarVisible: Boolean) {} - override fun setOngoingProcessRequiresStatusBarVisible(visible: Boolean) {} + override fun setOngoingProcessRequiresStatusBarVisible(visible: Boolean) { + ongoingProcessRequiresStatusBarVisible.value = visible + } } diff --git a/services/autofill/bugfixes.aconfig b/services/autofill/bugfixes.aconfig index 9c83757f4b0f..7c5cfa91ab8a 100644 --- a/services/autofill/bugfixes.aconfig +++ b/services/autofill/bugfixes.aconfig @@ -86,3 +86,13 @@ flag { description: "Highlight single field after autofill selection" bug: "41496744" } + +flag { + name: "metrics_fixes" + namespace: "autofill" + description: "Fixes various framework reported metrics" + bug: "362581326, 363011343" + metadata { + purpose: PURPOSE_BUGFIX + } +} diff --git a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java index bd1b0ea99e17..6ccf5e47ca6c 100644 --- a/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/PresentationStatsEventLogger.java @@ -45,6 +45,7 @@ import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_ import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_NO_FOCUS; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_REQUEST_TIMEOUT; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SESSION_COMMITTED_PREMATURELY; +import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_UNKNOWN_REASON; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED; import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_FOCUSED_BEFORE_FILL_DIALOG_RESPONSE; @@ -98,6 +99,7 @@ public final class PresentationStatsEventLogger { NOT_SHOWN_REASON_REQUEST_FAILED, NOT_SHOWN_REASON_NO_FOCUS, NOT_SHOWN_REASON_SESSION_COMMITTED_PREMATURELY, + NOT_SHOWN_REASON_SUGGESTION_FILTERED, NOT_SHOWN_REASON_UNKNOWN }) @Retention(RetentionPolicy.SOURCE) @@ -178,6 +180,8 @@ public final class PresentationStatsEventLogger { AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SESSION_COMMITTED_PREMATURELY; public static final int NOT_SHOWN_REASON_UNKNOWN = AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_UNKNOWN_REASON; + public static final int NOT_SHOWN_REASON_SUGGESTION_FILTERED = + AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT; public static final int AUTHENTICATION_TYPE_UNKNOWN = AUTOFILL_PRESENTATION_EVENT_REPORTED__AUTHENTICATION_TYPE__AUTHENTICATION_TYPE_UNKNOWN; @@ -286,12 +290,43 @@ public final class PresentationStatsEventLogger { }); } + /** + * Call this when first entering the View. It will check if there are pre-existing characters + * in the view, and sets NOT_SHOWN_REASON_SUGGESTION_FILTERED if there is + */ + public void maybeSetNoPresentationEventReasonSuggestionsFiltered(AutofillValue value) { + mEventInternal.ifPresent( + event -> { + if (value == null || !value.isText()) { + return; + } + + int length = value.getTextValue().length(); + + if (length > 0) { + maybeSetNoPresentationEventReason(NOT_SHOWN_REASON_SUGGESTION_FILTERED); + } + }); + } + public void maybeSetNoPresentationEventReasonIfNoReasonExists(@NotShownReason int reason) { - mEventInternal.ifPresent(event -> { - if (event.mCountShown == 0 && event.mNoPresentationReason == NOT_SHOWN_REASON_UNKNOWN) { - event.mNoPresentationReason = reason; - } - }); + mEventInternal.ifPresent( + event -> { + if (event.mCountShown != 0) { + return; + } + + // The only events that can be overwritten. + // NOT_SHOWN_REASON_UNKNOWN is the default for inline/dropdown + // NOT_SHOWN_REASON_NO_FOCUS is the default for fill dialog + if (event.mNoPresentationReason != NOT_SHOWN_REASON_UNKNOWN + || event.mNoPresentationReason != NOT_SHOWN_REASON_NO_FOCUS) { + Slog.d(TAG, "Not setting no presentation reason because it already exists"); + return; + } + + event.mNoPresentationReason = reason; + }); } public void maybeSetAvailableCount(@Nullable List<Dataset> datasetList, diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 9c6e4741730a..ba9865d513d7 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -41,6 +41,7 @@ import static android.service.autofill.FillRequest.FLAG_VIEW_REQUESTS_CREDMAN_SE import static android.service.autofill.FillRequest.INVALID_REQUEST_ID; import static android.service.autofill.Flags.highlightAutofillSingleField; import static android.service.autofill.Flags.improveFillDialogAconfig; +import static android.service.autofill.Flags.metricsFixes; import static android.view.autofill.AutofillManager.ACTION_RESPONSE_EXPIRED; import static android.view.autofill.AutofillManager.ACTION_START_SESSION; import static android.view.autofill.AutofillManager.ACTION_VALUE_CHANGED; @@ -3741,8 +3742,13 @@ final class Session final FillResponse lastResponse = getLastResponseLocked("logContextCommited(%s)"); if (lastResponse == null) return; - mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( - PresentationStatsEventLogger.getNoPresentationEventReason(commitReason)); + if (metricsFixes()) { + mPresentationStatsEventLogger.maybeSetNoPresentationEventReasonIfNoReasonExists( + PresentationStatsEventLogger.getNoPresentationEventReason(commitReason)); + } else { + mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + PresentationStatsEventLogger.getNoPresentationEventReason(commitReason)); + } mPresentationStatsEventLogger.logAndEndEvent("Context committed"); final int flags = lastResponse.getFlags(); @@ -5125,6 +5131,13 @@ final class Session mPreviouslyFillDialogPotentiallyStarted = false; } else { mPreviouslyFillDialogPotentiallyStarted = true; + if (metricsFixes()) { + // Set the default reason for now if the user doesn't trigger any focus + // event on the autofillable view. This can be changed downstream when + // more information is available or session is committed. + mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + NOT_SHOWN_REASON_NO_FOCUS); + } } Optional<Integer> maybeRequestId = requestNewFillResponseLocked( @@ -5291,6 +5304,10 @@ final class Session if (maybeNewRequestId.isPresent()) { mPresentationStatsEventLogger.maybeSetRequestId(maybeNewRequestId.get()); } + if (metricsFixes()) { + mPresentationStatsEventLogger + .maybeSetNoPresentationEventReasonSuggestionsFiltered(value); + } } logPresentationStatsOnViewEnteredLocked( @@ -5325,8 +5342,14 @@ final class Session // It's not necessary that there's no more presentation for this view. It could // be that the user chose some suggestion, in which case, view exits. - mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( - NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED); + if (metricsFixes()) { + mPresentationStatsEventLogger + .maybeSetNoPresentationEventReasonIfNoReasonExists( + NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED); + } else { + mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + NOT_SHOWN_REASON_VIEW_FOCUS_CHANGED); + } } break; default: @@ -6935,11 +6958,15 @@ final class Session private void startNewEventForPresentationStatsEventLogger() { synchronized (mLock) { mPresentationStatsEventLogger.startNewEvent(); - // Set the default reason for now if the user doesn't trigger any focus event - // on the autofillable view. This can be changed downstream when more - // information is available or session is committed. - mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( - NOT_SHOWN_REASON_NO_FOCUS); + // This is a fill dialog only state, moved to when we set + // mPreviouslyFillDialogPotentiallyStarted = true + if (!metricsFixes()) { + // Set the default reason for now if the user doesn't trigger any focus event + // on the autofillable view. This can be changed downstream when more + // information is available or session is committed. + mPresentationStatsEventLogger.maybeSetNoPresentationEventReason( + NOT_SHOWN_REASON_NO_FOCUS); + } mPresentationStatsEventLogger.maybeSetDetectionPreference( getDetectionPreferenceForLogging()); mPresentationStatsEventLogger.maybeSetAutofillServiceUid(getAutofillServiceUid()); @@ -7696,7 +7723,11 @@ final class Session if (sVerbose) { Slog.v(TAG, "logAllEvents(" + id + "): commitReason: " + val); } - mSessionCommittedEventLogger.maybeSetCommitReason(val); + if (metricsFixes()) { + mSessionCommittedEventLogger.maybeSetCommitReasonIfUnset(val); + } else { + mSessionCommittedEventLogger.maybeSetCommitReason(val); + } mSessionCommittedEventLogger.maybeSetRequestCount(mRequestCount); mSessionCommittedEventLogger.maybeSetSessionDurationMillis( SystemClock.elapsedRealtime() - mStartTime); diff --git a/services/autofill/java/com/android/server/autofill/SessionCommittedEventLogger.java b/services/autofill/java/com/android/server/autofill/SessionCommittedEventLogger.java index 8f3c8803154d..7fd5648156a8 100644 --- a/services/autofill/java/com/android/server/autofill/SessionCommittedEventLogger.java +++ b/services/autofill/java/com/android/server/autofill/SessionCommittedEventLogger.java @@ -76,6 +76,17 @@ public final class SessionCommittedEventLogger { }); } + /** Set commit_reason if not already set */ + public void maybeSetCommitReasonIfUnset(@AutofillCommitReason int val) { + mEventInternal.ifPresent( + event -> { + if (event.mCommitReason != COMMIT_REASON_UNKNOWN) { + return; + } + event.mCommitReason = val; + }); + } + /** * Set session_duration_millis as long as mEventInternal presents. */ diff --git a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java index 236333ee433d..18ae0446b3e0 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java @@ -303,6 +303,10 @@ abstract class HdmiCecFeatureAction { return mSource.getDeviceInfo().getPhysicalAddress(); } + protected final int getServicePath() { + return mService.getPhysicalAddress(); + } + protected final void sendUserControlPressedAndReleased(int targetAddress, int uiCommand) { mSource.sendUserControlPressedAndReleased(targetAddress, uiCommand); } diff --git a/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java b/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java index 256905d50dc1..9f6322d9b229 100644 --- a/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java +++ b/services/core/java/com/android/server/hdmi/OneTouchPlayAction.java @@ -152,7 +152,8 @@ final class OneTouchPlayAction extends HdmiCecFeatureAction { // If the device wasn´t the active source yet, // this makes it the active source and wakes it up. mSource.mService.setAndBroadcastActiveSourceFromOneDeviceType( - mTargetAddress, getSourcePath(), "OneTouchPlayAction#broadcastActiveSource()"); + mTargetAddress, getServicePath(), + "OneTouchPlayAction#broadcastActiveSource()"); // When OneTouchPlay is called, client side should be responsible to send out the intent // of which internal source, for example YouTube, it would like to switch to. // Here we only update the active port and the active source records in the local diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index 1fc609b7d03a..bcd12f253299 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -1870,7 +1870,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { final DisplayArea<?> da = wc.asDisplayArea(); if (da == null) continue; if (da.isVisibleRequested()) { - mController.mValidateDisplayVis.remove(da); + final int inValidateList = mController.mValidateDisplayVis.indexOf(da); + if (inValidateList >= 0 + // The display-area is visible, but if we only detect a non-visibility + // change, then we shouldn't remove the validator. + && !mChanges.get(da).mVisible) { + mController.mValidateDisplayVis.remove(inValidateList); + } } else { // In case something accidentally hides a displayarea and nothing shows it again. mController.mValidateDisplayVis.add(da); diff --git a/services/tests/servicestests/src/com/android/server/autofill/PresentationEventLoggerTest.java b/services/tests/servicestests/src/com/android/server/autofill/PresentationEventLoggerTest.java index 75258f0aa7e0..d2db999d72ca 100644 --- a/services/tests/servicestests/src/com/android/server/autofill/PresentationEventLoggerTest.java +++ b/services/tests/servicestests/src/com/android/server/autofill/PresentationEventLoggerTest.java @@ -15,6 +15,8 @@ */ package com.android.server.autofill; +import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT; +import static com.android.internal.util.FrameworkStatsLog.AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED; import static com.google.common.truth.Truth.assertThat; @@ -129,4 +131,57 @@ public class PresentationEventLoggerTest { assertThat(event).isNotNull(); assertThat(event.mDisplayPresentationType).isEqualTo(3); } + + @Test + public void testNoSuggestionsTextFiltered() { + PresentationStatsEventLogger pEventLogger = + PresentationStatsEventLogger.createPresentationLog(1, 1, 1); + AutofillId id = new AutofillId(13); + AutofillValue initialValue = AutofillValue.forText("hello"); + pEventLogger.startNewEvent(); + pEventLogger.maybeSetFocusedId(id); + pEventLogger.maybeSetNoPresentationEventReasonSuggestionsFiltered(initialValue); + + PresentationStatsEventLogger.PresentationStatsEventInternal event = + pEventLogger.getInternalEvent().get(); + assertThat(event).isNotNull(); + int NO_SUGGESTIONS = + AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT; + assertThat(event.mNoPresentationReason).isEqualTo(NO_SUGGESTIONS); + } + + @Test + public void testSuggestionsTextNotFiltered() { + PresentationStatsEventLogger pEventLogger = + PresentationStatsEventLogger.createPresentationLog(1, 1, 1); + AutofillId id = new AutofillId(13); + AutofillValue initialValue = null; + pEventLogger.startNewEvent(); + pEventLogger.maybeSetFocusedId(id); + pEventLogger.maybeSetNoPresentationEventReasonSuggestionsFiltered(initialValue); + + PresentationStatsEventLogger.PresentationStatsEventInternal event = + pEventLogger.getInternalEvent().get(); + assertThat(event).isNotNull(); + assertThat(event.mNoPresentationReason).isNotEqualTo( + AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT); + } + + @Test + public void testNotShownReasonNotOverridden() { + + PresentationStatsEventLogger pEventLogger = + PresentationStatsEventLogger.createPresentationLog(1, 1, 1); + + pEventLogger.startNewEvent(); + pEventLogger.maybeSetNoPresentationEventReason(AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED); + // Not allowed - no op + pEventLogger.maybeSetNoPresentationEventReasonIfNoReasonExists( + AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_SUGGESTION_FILTER_OUT); + + PresentationStatsEventLogger.PresentationStatsEventInternal event = + pEventLogger.getInternalEvent().get(); + assertThat(event).isNotNull(); + assertThat(event.mNoPresentationReason).isEqualTo(AUTOFILL_PRESENTATION_EVENT_REPORTED__PRESENTATION_EVENT_RESULT__NONE_SHOWN_VIEW_CHANGED); + } } diff --git a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java index a0f2395f5203..d70ffd2ec050 100644 --- a/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java +++ b/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java @@ -159,7 +159,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Test for the first launch path, no settings file available. */ - public void testFirstInitialize() { + public void FirstInitialize() { assertResetTimes(START_TIME, START_TIME + INTERVAL); } @@ -167,7 +167,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { * Test for {@link ShortcutService#getLastResetTimeLocked()} and * {@link ShortcutService#getNextResetTimeLocked()}. */ - public void testUpdateAndGetNextResetTimeLocked() { + public void UpdateAndGetNextResetTimeLocked() { assertResetTimes(START_TIME, START_TIME + INTERVAL); // Advance clock. @@ -196,7 +196,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Test for the restoration from saved file. */ - public void testInitializeFromSavedFile() { + public void InitializeFromSavedFile() { mInjectedCurrentTimeMillis = START_TIME + 4 * INTERVAL + 50; assertResetTimes(START_TIME + 4 * INTERVAL, START_TIME + 5 * INTERVAL); @@ -220,7 +220,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Add various broken cases. } - public void testLoadConfig() { + public void LoadConfig() { mService.updateConfigurationLocked( ConfigConstants.KEY_RESET_INTERVAL_SEC + "=123," + ConfigConstants.KEY_MAX_SHORTCUTS + "=4," @@ -261,22 +261,22 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // === Test for app side APIs === /** Test for {@link android.content.pm.ShortcutManager#getMaxShortcutCountForActivity()} */ - public void testGetMaxDynamicShortcutCount() { + public void GetMaxDynamicShortcutCount() { assertEquals(MAX_SHORTCUTS, mManager.getMaxShortcutCountForActivity()); } /** Test for {@link android.content.pm.ShortcutManager#getRemainingCallCount()} */ - public void testGetRemainingCallCount() { + public void GetRemainingCallCount() { assertEquals(MAX_UPDATES_PER_INTERVAL, mManager.getRemainingCallCount()); } - public void testGetIconMaxDimensions() { + public void GetIconMaxDimensions() { assertEquals(MAX_ICON_DIMENSION, mManager.getIconMaxWidth()); assertEquals(MAX_ICON_DIMENSION, mManager.getIconMaxHeight()); } /** Test for {@link android.content.pm.ShortcutManager#getRateLimitResetTime()} */ - public void testGetRateLimitResetTime() { + public void GetRateLimitResetTime() { assertEquals(START_TIME + INTERVAL, mManager.getRateLimitResetTime()); mInjectedCurrentTimeMillis = START_TIME + 4 * INTERVAL + 50; @@ -284,7 +284,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals(START_TIME + 5 * INTERVAL, mManager.getRateLimitResetTime()); } - public void testSetDynamicShortcuts() { + public void SetDynamicShortcuts() { setCaller(CALLING_PACKAGE_1, USER_0); final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.icon1); @@ -354,7 +354,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testAddDynamicShortcuts() { + public void AddDynamicShortcuts() { setCaller(CALLING_PACKAGE_1, USER_0); final ShortcutInfo si1 = makeShortcut("shortcut1"); @@ -402,7 +402,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPushDynamicShortcut() { + public void PushDynamicShortcut() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=5," + ShortcutService.ConfigConstants.KEY_SAVE_DELAY_MILLIS + "=1"); @@ -543,7 +543,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { eq(CALLING_PACKAGE_1), eq("s9"), eq(USER_0)); } - public void testPushDynamicShortcut_CallsToUsageStatsManagerAreThrottled() + public void PushDynamicShortcut_CallsToUsageStatsManagerAreThrottled() throws InterruptedException { mService.updateConfigurationLocked( ShortcutService.ConfigConstants.KEY_SAVE_DELAY_MILLIS + "=500"); @@ -594,7 +594,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { eq(CALLING_PACKAGE_2), any(), eq(USER_0)); } - public void testUnlimitedCalls() { + public void UnlimitedCalls() { setCaller(CALLING_PACKAGE_1, USER_0); final ShortcutInfo si1 = makeShortcut("shortcut1"); @@ -625,7 +625,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals(3, mManager.getRemainingCallCount()); } - public void testPublishWithNoActivity() { + public void PublishWithNoActivity() { // If activity is not explicitly set, use the default one. mRunningUsers.put(USER_10, true); @@ -731,7 +731,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPublishWithNoActivity_noMainActivityInPackage() { + public void PublishWithNoActivity_noMainActivityInPackage() { mRunningUsers.put(USER_10, true); runWithCaller(CALLING_PACKAGE_2, USER_10, () -> { @@ -750,7 +750,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testDeleteDynamicShortcuts() { + public void DeleteDynamicShortcuts() { final ShortcutInfo si1 = makeShortcut("shortcut1"); final ShortcutInfo si2 = makeShortcut("shortcut2"); final ShortcutInfo si3 = makeShortcut("shortcut3"); @@ -791,7 +791,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals(2, mManager.getRemainingCallCount()); } - public void testDeleteAllDynamicShortcuts() { + public void DeleteAllDynamicShortcuts() { final ShortcutInfo si1 = makeShortcut("shortcut1"); final ShortcutInfo si2 = makeShortcut("shortcut2"); final ShortcutInfo si3 = makeShortcut("shortcut3"); @@ -820,7 +820,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals(1, mManager.getRemainingCallCount()); } - public void testIcons() throws IOException { + public void Icons() throws IOException { final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32); final Icon res64x64 = Icon.createWithResource(getTestContext(), R.drawable.black_64x64); final Icon res512x512 = Icon.createWithResource(getTestContext(), R.drawable.black_512x512); @@ -1034,7 +1034,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { */ } - public void testCleanupDanglingBitmaps() throws Exception { + public void CleanupDanglingBitmaps() throws Exception { assertBitmapDirectories(USER_0, EMPTY_STRINGS); assertBitmapDirectories(USER_10, EMPTY_STRINGS); @@ -1203,7 +1203,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { maxSize)); } - public void testShrinkBitmap() { + public void ShrinkBitmap() { checkShrinkBitmap(32, 32, R.drawable.black_512x512, 32); checkShrinkBitmap(511, 511, R.drawable.black_512x512, 511); checkShrinkBitmap(512, 512, R.drawable.black_512x512, 512); @@ -1226,7 +1226,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { return out.getFile(); } - public void testOpenIconFileForWrite() throws IOException { + public void OpenIconFileForWrite() throws IOException { mInjectedCurrentTimeMillis = 1000; final File p10_1_1 = openIconFileForWriteAndGetPath(10, CALLING_PACKAGE_1); @@ -1300,7 +1300,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertFalse(p11_1_3.getName().contains("_")); } - public void testUpdateShortcuts() { + public void UpdateShortcuts() { runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { assertTrue(mManager.setDynamicShortcuts(list( makeShortcut("s1"), @@ -1431,7 +1431,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testUpdateShortcuts_icons() { + public void UpdateShortcuts_icons() { runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { assertTrue(mManager.setDynamicShortcuts(list( makeShortcut("s1") @@ -1525,7 +1525,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testShortcutManagerGetShortcuts_shortcutTypes() { + public void ShortcutManagerGetShortcuts_shortcutTypes() { // Create 3 manifest and 3 dynamic shortcuts addManifestShortcutResource( @@ -1616,7 +1616,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED), "s1", "s2"); } - public void testCachedShortcuts() { + public void CachedShortcuts() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"), makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"), @@ -1700,7 +1700,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { "s2"); } - public void testCachedShortcuts_accessShortcutsPermission() { + public void CachedShortcuts_accessShortcutsPermission() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list(makeShortcut("s1"), makeLongLivedShortcut("s2"), makeLongLivedShortcut("s3"), @@ -1742,7 +1742,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertShortcutIds(mManager.getShortcuts(ShortcutManager.FLAG_MATCH_CACHED), "s3"); } - public void testCachedShortcuts_canPassShortcutLimit() { + public void CachedShortcuts_canPassShortcutLimit() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=4"); @@ -1780,7 +1780,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // === Test for launcher side APIs === - public void testGetShortcuts() { + public void GetShortcuts() { // Set up shortcuts. @@ -1997,7 +1997,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { "s1", "s3"); } - public void testGetShortcuts_shortcutKinds() throws Exception { + public void GetShortcuts_shortcutKinds() throws Exception { // Create 3 manifest and 3 dynamic shortcuts addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), @@ -2108,7 +2108,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testGetShortcuts_resolveStrings() throws Exception { + public void GetShortcuts_resolveStrings() throws Exception { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { ShortcutInfo si = new ShortcutInfo.Builder(mClientContext) .setId("id") @@ -2156,7 +2156,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testGetShortcuts_personsFlag() { + public void GetShortcuts_personsFlag() { ShortcutInfo s = new ShortcutInfo.Builder(mClientContext, "id") .setShortLabel("label") .setActivity(new ComponentName(mClientContext, ShortcutActivity2.class)) @@ -2204,7 +2204,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } // TODO resource - public void testGetShortcutInfo() { + public void GetShortcutInfo() { // Create shortcuts. setCaller(CALLING_PACKAGE_1); final ShortcutInfo s1_1 = makeShortcut( @@ -2279,7 +2279,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals("ABC", findById(list, "s1").getTitle()); } - public void testPinShortcutAndGetPinnedShortcuts() { + public void PinShortcutAndGetPinnedShortcuts() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { final ShortcutInfo s1_1 = makeShortcutWithTimestamp("s1", 1000); final ShortcutInfo s1_2 = makeShortcutWithTimestamp("s2", 2000); @@ -2360,7 +2360,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { * This is similar to the above test, except it used "disable" instead of "remove". It also * does "enable". */ - public void testDisableAndEnableShortcuts() { + public void DisableAndEnableShortcuts() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { final ShortcutInfo s1_1 = makeShortcutWithTimestamp("s1", 1000); final ShortcutInfo s1_2 = makeShortcutWithTimestamp("s2", 2000); @@ -2485,7 +2485,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testDisableShortcuts_thenRepublish() { + public void DisableShortcuts_thenRepublish() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( makeShortcut("s1"), makeShortcut("s2"), makeShortcut("s3")))); @@ -2555,7 +2555,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPinShortcutAndGetPinnedShortcuts_multi() { + public void PinShortcutAndGetPinnedShortcuts_multi() { // Create some shortcuts. runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( @@ -2831,7 +2831,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPinShortcutAndGetPinnedShortcuts_assistant() { + public void PinShortcutAndGetPinnedShortcuts_assistant() { // Create some shortcuts. runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( @@ -2887,7 +2887,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPinShortcutAndGetPinnedShortcuts_crossProfile_plusLaunch() { + public void PinShortcutAndGetPinnedShortcuts_crossProfile_plusLaunch() { // Create some shortcuts. runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( @@ -3476,7 +3476,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testStartShortcut() { + public void StartShortcut() { // Create some shortcuts. runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { final ShortcutInfo s1_1 = makeShortcut( @@ -3611,7 +3611,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Check extra, etc } - public void testLauncherCallback() throws Throwable { + public void LauncherCallback() throws Throwable { // Disable throttling for this test. mService.updateConfigurationLocked( ConfigConstants.KEY_MAX_UPDATES_PER_INTERVAL + "=99999999," @@ -3777,7 +3777,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { .isEmpty(); } - public void testLauncherCallback_crossProfile() throws Throwable { + public void LauncherCallback_crossProfile() throws Throwable { prepareCrossProfileDataSet(); final Handler h = new Handler(Looper.getMainLooper()); @@ -3900,7 +3900,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // === Test for persisting === - public void testSaveAndLoadUser_empty() { + public void SaveAndLoadUser_empty() { assertTrue(mManager.setDynamicShortcuts(list())); Log.i(TAG, "Saved state"); @@ -3917,7 +3917,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Try save and load, also stop/start the user. */ - public void testSaveAndLoadUser() { + public void SaveAndLoadUser() { // First, create some shortcuts and save. runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x16); @@ -4058,7 +4058,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Check all other fields } - public void testLoadCorruptedShortcuts() throws Exception { + public void LoadCorruptedShortcuts() throws Exception { initService(); addPackage("com.android.chrome", 0, 0); @@ -4072,7 +4072,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertNull(ShortcutPackage.loadFromFile(mService, user, corruptedShortcutPackage, false)); } - public void testSaveCorruptAndLoadUser() throws Exception { + public void SaveCorruptAndLoadUser() throws Exception { // First, create some shortcuts and save. runWithCaller(CALLING_PACKAGE_1, UserHandle.USER_SYSTEM, () -> { final Icon icon1 = Icon.createWithResource(getTestContext(), R.drawable.black_64x16); @@ -4228,7 +4228,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { // TODO Check all other fields } - public void testCleanupPackage() { + public void CleanupPackage() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( makeShortcut("s0_1")))); @@ -4505,7 +4505,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mService.saveDirtyInfo(); } - public void testCleanupPackage_republishManifests() { + public void CleanupPackage_republishManifests() { addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), R.xml.shortcut_2); @@ -4573,7 +4573,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHandleGonePackage_crossProfile() { + public void HandleGonePackage_crossProfile() { // Create some shortcuts. runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( @@ -4845,7 +4845,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertEquals(expected, spi.canRestoreTo(mService, pi, true)); } - public void testCanRestoreTo() { + public void CanRestoreTo() { addPackage(CALLING_PACKAGE_1, CALLING_UID_1, 10, "sig1"); addPackage(CALLING_PACKAGE_2, CALLING_UID_2, 10, "sig1", "sig2"); addPackage(CALLING_PACKAGE_3, CALLING_UID_3, 10, "sig1"); @@ -4908,7 +4908,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkCanRestoreTo(DISABLED_REASON_BACKUP_NOT_SUPPORTED, spi3, true, 10, true, "sig1"); } - public void testHandlePackageDelete() { + public void HandlePackageDelete() { checkHandlePackageDeleteInner((userId, packageName) -> { uninstallPackage(userId, packageName); mService.mPackageMonitor.onReceive(getTestContext(), @@ -4916,7 +4916,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHandlePackageDisable() { + public void HandlePackageDisable() { checkHandlePackageDeleteInner((userId, packageName) -> { disablePackage(userId, packageName); mService.mPackageMonitor.onReceive(getTestContext(), @@ -5048,7 +5048,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } /** Almost ame as testHandlePackageDelete, except it doesn't uninstall packages. */ - public void testHandlePackageClearData() { + public void HandlePackageClearData() { final Icon bmp32x32 = Icon.createWithBitmap(BitmapFactory.decodeResource( getTestContext().getResources(), R.drawable.black_32x32)); setCaller(CALLING_PACKAGE_1, USER_0); @@ -5124,7 +5124,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertTrue(bitmapDirectoryExists(CALLING_PACKAGE_3, USER_10)); } - public void testHandlePackageClearData_manifestRepublished() { + public void HandlePackageClearData_manifestRepublished() { mRunningUsers.put(USER_10, true); @@ -5166,7 +5166,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHandlePackageUpdate() throws Throwable { + public void HandlePackageUpdate() throws Throwable { // Set up shortcuts and launchers. final Icon res32x32 = Icon.createWithResource(getTestContext(), R.drawable.black_32x32); @@ -5340,7 +5340,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Test the case where an updated app has resource IDs changed. */ - public void testHandlePackageUpdate_resIdChanged() throws Exception { + public void HandlePackageUpdate_resIdChanged() throws Exception { final Icon icon1 = Icon.createWithResource(getTestContext(), /* res ID */ 1000); final Icon icon2 = Icon.createWithResource(getTestContext(), /* res ID */ 1001); @@ -5415,7 +5415,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHandlePackageUpdate_systemAppUpdate() { + public void HandlePackageUpdate_systemAppUpdate() { // Package1 is a system app. Package 2 is not a system app, so it's not scanned // in this test at all. @@ -5521,7 +5521,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mService.getUserShortcutsLocked(USER_0).getLastAppScanOsFingerprint()); } - public void testHandlePackageChanged() { + public void HandlePackageChanged() { final ComponentName ACTIVITY1 = new ComponentName(CALLING_PACKAGE_1, "act1"); final ComponentName ACTIVITY2 = new ComponentName(CALLING_PACKAGE_1, "act2"); @@ -5651,7 +5651,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHandlePackageUpdate_activityNoLongerMain() throws Throwable { + public void HandlePackageUpdate_activityNoLongerMain() throws Throwable { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertTrue(mManager.setDynamicShortcuts(list( makeShortcutWithActivity("s1a", @@ -5737,7 +5737,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { * - Unpinned dynamic shortcuts * - Bitmaps */ - public void testBackupAndRestore() { + public void BackupAndRestore() { assertFileNotExists("user-0/shortcut_dump/restore-0-start.txt"); assertFileNotExists("user-0/shortcut_dump/restore-1-payload.xml"); @@ -5758,7 +5758,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_success(/*firstRestore=*/ true); } - public void testBackupAndRestore_backupRestoreTwice() { + public void BackupAndRestore_backupRestoreTwice() { prepareForBackupTest(); checkBackupAndRestore_success(/*firstRestore=*/ true); @@ -5774,7 +5774,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_success(/*firstRestore=*/ false); } - public void testBackupAndRestore_restoreToNewVersion() { + public void BackupAndRestore_restoreToNewVersion() { prepareForBackupTest(); addPackage(CALLING_PACKAGE_1, CALLING_UID_1, 2); @@ -5783,7 +5783,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_success(/*firstRestore=*/ true); } - public void testBackupAndRestore_restoreToSuperSetSignatures() { + public void BackupAndRestore_restoreToSuperSetSignatures() { prepareForBackupTest(); // Change package signatures. @@ -5980,7 +5980,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testBackupAndRestore_publisherWrongSignature() { + public void BackupAndRestore_publisherWrongSignature() { prepareForBackupTest(); addPackage(CALLING_PACKAGE_1, CALLING_UID_1, 10, "sigx"); // different signature @@ -5988,7 +5988,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_publisherNotRestored(ShortcutInfo.DISABLED_REASON_SIGNATURE_MISMATCH); } - public void testBackupAndRestore_publisherNoLongerBackupTarget() { + public void BackupAndRestore_publisherNoLongerBackupTarget() { prepareForBackupTest(); updatePackageInfo(CALLING_PACKAGE_1, @@ -6117,7 +6117,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testBackupAndRestore_launcherLowerVersion() { + public void BackupAndRestore_launcherLowerVersion() { prepareForBackupTest(); addPackage(LAUNCHER_1, LAUNCHER_UID_1, 0); // Lower version @@ -6126,7 +6126,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_success(/*firstRestore=*/ true); } - public void testBackupAndRestore_launcherWrongSignature() { + public void BackupAndRestore_launcherWrongSignature() { prepareForBackupTest(); addPackage(LAUNCHER_1, LAUNCHER_UID_1, 10, "sigx"); // different signature @@ -6134,7 +6134,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { checkBackupAndRestore_launcherNotRestored(true); } - public void testBackupAndRestore_launcherNoLongerBackupTarget() { + public void BackupAndRestore_launcherNoLongerBackupTarget() { prepareForBackupTest(); updatePackageInfo(LAUNCHER_1, @@ -6239,7 +6239,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testBackupAndRestore_launcherAndPackageNoLongerBackupTarget() { + public void BackupAndRestore_launcherAndPackageNoLongerBackupTarget() { prepareForBackupTest(); updatePackageInfo(CALLING_PACKAGE_1, @@ -6337,7 +6337,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testBackupAndRestore_disabled() { + public void BackupAndRestore_disabled() { prepareCrossProfileDataSet(); // Before doing backup & restore, disable s1. @@ -6402,7 +6402,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } - public void testBackupAndRestore_manifestRePublished() { + public void BackupAndRestore_manifestRePublished() { // Publish two manifest shortcuts. addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), @@ -6493,7 +6493,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { * logcat. * - if it has allowBackup=false, we don't touch any of the existing shortcuts. */ - public void testBackupAndRestore_appAlreadyInstalledWhenRestored() { + public void BackupAndRestore_appAlreadyInstalledWhenRestored() { // Pre-backup. Same as testBackupAndRestore_manifestRePublished(). // Publish two manifest shortcuts. @@ -6618,7 +6618,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Test for restoring the pre-P backup format. */ - public void testBackupAndRestore_api27format() throws Exception { + public void BackupAndRestore_api27format() throws Exception { final byte[] payload = readTestAsset("shortcut/shortcut_api27_backup.xml").getBytes(); addPackage(CALLING_PACKAGE_1, CALLING_UID_1, 10, "22222"); @@ -6656,7 +6656,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } - public void testSaveAndLoad_crossProfile() { + public void SaveAndLoad_crossProfile() { prepareCrossProfileDataSet(); dumpsysOnLogcat("Before save & load"); @@ -6859,7 +6859,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { .getPackageUserId()); } - public void testOnApplicationActive_permission() { + public void OnApplicationActive_permission() { assertExpectException(SecurityException.class, "Missing permission", () -> mManager.onApplicationActive(CALLING_PACKAGE_1, USER_0)); @@ -6868,7 +6868,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mManager.onApplicationActive(CALLING_PACKAGE_1, USER_0); } - public void testGetShareTargets_permission() { + public void GetShareTargets_permission() { addPackage(CHOOSER_ACTIVITY_PACKAGE, CHOOSER_ACTIVITY_UID, 10, "sig1"); mInjectedChooserActivity = ComponentName.createRelative(CHOOSER_ACTIVITY_PACKAGE, ".ChooserActivity"); @@ -6887,7 +6887,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testHasShareTargets_permission() { + public void HasShareTargets_permission() { assertExpectException(SecurityException.class, "Missing permission", () -> mManager.hasShareTargets(CALLING_PACKAGE_1)); @@ -6896,7 +6896,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mManager.hasShareTargets(CALLING_PACKAGE_1); } - public void testisSharingShortcut_permission() throws IntentFilter.MalformedMimeTypeException { + public void isSharingShortcut_permission() throws IntentFilter.MalformedMimeTypeException { setCaller(LAUNCHER_1, USER_0); IntentFilter filter_any = new IntentFilter(); @@ -6911,18 +6911,18 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { mManager.hasShareTargets(CALLING_PACKAGE_1); } - public void testDumpsys_crossProfile() { + public void Dumpsys_crossProfile() { prepareCrossProfileDataSet(); dumpsysOnLogcat("test1", /* force= */ true); } - public void testDumpsys_withIcons() throws IOException { - testIcons(); + public void Dumpsys_withIcons() throws IOException { + Icons(); // Dump after having some icons. dumpsysOnLogcat("test1", /* force= */ true); } - public void testManifestShortcut_publishOnUnlockUser() { + public void ManifestShortcut_publishOnUnlockUser() { addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), R.xml.shortcut_1); @@ -7136,7 +7136,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertNull(mService.getPackageShortcutForTest(LAUNCHER_1, USER_0)); } - public void testManifestShortcut_publishOnBroadcast() { + public void ManifestShortcut_publishOnBroadcast() { // First, no packages are installed. uninstallPackage(USER_0, CALLING_PACKAGE_1); uninstallPackage(USER_0, CALLING_PACKAGE_2); @@ -7392,7 +7392,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_missingMandatoryFields() { + public void ManifestShortcuts_missingMandatoryFields() { // Start with no apps installed. uninstallPackage(USER_0, CALLING_PACKAGE_1); uninstallPackage(USER_0, CALLING_PACKAGE_2); @@ -7461,7 +7461,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_intentDefinitions() { + public void ManifestShortcuts_intentDefinitions() { addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), R.xml.shortcut_error_4); @@ -7603,7 +7603,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_checkAllFields() { + public void ManifestShortcuts_checkAllFields() { mService.handleUnlockUser(USER_0); // Package 1 updated, which has one valid manifest shortcut and one invalid. @@ -7708,7 +7708,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_localeChange() throws InterruptedException { + public void ManifestShortcuts_localeChange() throws InterruptedException { mService.handleUnlockUser(USER_0); // Package 1 updated, which has one valid manifest shortcut and one invalid. @@ -7812,7 +7812,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_updateAndDisabled_notPinned() { + public void ManifestShortcuts_updateAndDisabled_notPinned() { mService.handleUnlockUser(USER_0); // First, just publish a manifest shortcut. @@ -7852,7 +7852,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_updateAndDisabled_pinned() { + public void ManifestShortcuts_updateAndDisabled_pinned() { mService.handleUnlockUser(USER_0); // First, just publish a manifest shortcut. @@ -7908,7 +7908,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_duplicateInSingleActivity() { + public void ManifestShortcuts_duplicateInSingleActivity() { mService.handleUnlockUser(USER_0); // The XML has two shortcuts with the same ID. @@ -7933,7 +7933,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testManifestShortcuts_duplicateInTwoActivities() { + public void ManifestShortcuts_duplicateInTwoActivities() { mService.handleUnlockUser(USER_0); // ShortcutActivity has shortcut ms1 @@ -7985,7 +7985,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Manifest shortcuts cannot override shortcuts that were published via the APIs. */ - public void testManifestShortcuts_cannotOverrideNonManifest() { + public void ManifestShortcuts_cannotOverrideNonManifest() { mService.handleUnlockUser(USER_0); // Create a non-pinned dynamic shortcut and a non-dynamic pinned shortcut. @@ -8058,7 +8058,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Make sure the APIs won't work on manifest shortcuts. */ - public void testManifestShortcuts_immutable() { + public void ManifestShortcuts_immutable() { mService.handleUnlockUser(USER_0); // Create a non-pinned manifest shortcut, a pinned shortcut that was originally @@ -8151,7 +8151,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { /** * Make sure the APIs won't work on manifest shortcuts. */ - public void testManifestShortcuts_tooMany() { + public void ManifestShortcuts_tooMany() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3"); @@ -8170,7 +8170,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testMaxShortcutCount_set() { + public void MaxShortcutCount_set() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3"); @@ -8251,7 +8251,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testMaxShortcutCount_add() { + public void MaxShortcutCount_add() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3"); @@ -8378,7 +8378,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testMaxShortcutCount_update() { + public void MaxShortcutCount_update() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3"); @@ -8469,7 +8469,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testShortcutsPushedOutByManifest() { + public void ShortcutsPushedOutByManifest() { // Change the max number of shortcuts. mService.updateConfigurationLocked(ConfigConstants.KEY_MAX_SHORTCUTS + "=3"); @@ -8577,7 +8577,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testReturnedByServer() { + public void ReturnedByServer() { // Package 1 updated, with manifest shortcuts. addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), @@ -8623,7 +8623,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testIsForegroundDefaultLauncher_true() { + public void IsForegroundDefaultLauncher_true() { final int uid = 1024; setDefaultLauncher(UserHandle.USER_SYSTEM, "default"); @@ -8633,7 +8633,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } - public void testIsForegroundDefaultLauncher_defaultButNotForeground() { + public void IsForegroundDefaultLauncher_defaultButNotForeground() { final int uid = 1024; setDefaultLauncher(UserHandle.USER_SYSTEM, "default"); @@ -8642,7 +8642,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertFalse(mInternal.isForegroundDefaultLauncher("default", uid)); } - public void testIsForegroundDefaultLauncher_foregroundButNotDefault() { + public void IsForegroundDefaultLauncher_foregroundButNotDefault() { final int uid = 1024; setDefaultLauncher(UserHandle.USER_SYSTEM, "default"); @@ -8651,7 +8651,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { assertFalse(mInternal.isForegroundDefaultLauncher("another", uid)); } - public void testParseShareTargetsFromManifest() { + public void ParseShareTargetsFromManifest() { // These values must exactly match the content of shortcuts_share_targets.xml resource List<ShareTargetInfo> expectedValues = new ArrayList<>(); expectedValues.add(new ShareTargetInfo( @@ -8703,7 +8703,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } } - public void testShareTargetInfo_saveToXml() throws IOException, XmlPullParserException { + public void ShareTargetInfo_saveToXml() throws IOException, XmlPullParserException { List<ShareTargetInfo> expectedValues = new ArrayList<>(); expectedValues.add(new ShareTargetInfo( new ShareTargetInfo.TargetData[]{new ShareTargetInfo.TargetData( @@ -8769,7 +8769,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { } } - public void testIsSharingShortcut() throws IntentFilter.MalformedMimeTypeException { + public void IsSharingShortcut() throws IntentFilter.MalformedMimeTypeException { addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), R.xml.shortcut_share_targets); @@ -8819,7 +8819,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { filter_any)); } - public void testIsSharingShortcut_PinnedAndCachedOnlyShortcuts() + public void IsSharingShortcut_PinnedAndCachedOnlyShortcuts() throws IntentFilter.MalformedMimeTypeException { addManifestShortcutResource( new ComponentName(CALLING_PACKAGE_1, ShortcutActivity.class.getName()), @@ -8876,7 +8876,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { filter_any)); } - public void testAddingShortcuts_ExcludesHiddenFromLauncherShortcuts() { + public void AddingShortcuts_ExcludesHiddenFromLauncherShortcuts() { final ShortcutInfo s1 = makeShortcutExcludedFromLauncher("s1"); final ShortcutInfo s2 = makeShortcutExcludedFromLauncher("s2"); final ShortcutInfo s3 = makeShortcutExcludedFromLauncher("s3"); @@ -8897,7 +8897,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testUpdateShortcuts_ExcludesHiddenFromLauncherShortcuts() { + public void UpdateShortcuts_ExcludesHiddenFromLauncherShortcuts() { final ShortcutInfo s1 = makeShortcut("s1"); final ShortcutInfo s2 = makeShortcut("s2"); final ShortcutInfo s3 = makeShortcut("s3"); @@ -8910,7 +8910,7 @@ public class ShortcutManagerTest1 extends BaseShortcutManagerTest { }); } - public void testPinHiddenShortcuts_ThrowsException() { + public void PinHiddenShortcuts_ThrowsException() { runWithCaller(CALLING_PACKAGE_1, USER_0, () -> { assertThrown(IllegalArgumentException.class, () -> { mManager.requestPinShortcut(makeShortcutExcludedFromLauncher("s1"), null); diff --git a/telephony/java/android/telephony/Annotation.java b/telephony/java/android/telephony/Annotation.java index 09b18b65be4a..8fe107cc1ad3 100644 --- a/telephony/java/android/telephony/Annotation.java +++ b/telephony/java/android/telephony/Annotation.java @@ -109,7 +109,6 @@ public class Annotation { //TelephonyManager.NETWORK_TYPE_LTE_CA, TelephonyManager.NETWORK_TYPE_NR, - TelephonyManager.NETWORK_TYPE_NB_IOT_NTN, }) @Retention(RetentionPolicy.SOURCE) public @interface NetworkType { diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java index 8b52f07102b8..90d6f89553b7 100644 --- a/telephony/java/android/telephony/RadioAccessFamily.java +++ b/telephony/java/android/telephony/RadioAccessFamily.java @@ -66,9 +66,6 @@ public class RadioAccessFamily implements Parcelable { // 5G public static final int RAF_NR = (int) TelephonyManager.NETWORK_TYPE_BITMASK_NR; - /** NB-IOT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. */ - public static final int RAF_NB_IOT_NTN = (int) TelephonyManager.NETWORK_TYPE_BITMASK_NB_IOT_NTN; - // Grouping of RAFs // 2G private static final int GSM = RAF_GSM | RAF_GPRS | RAF_EDGE; @@ -83,9 +80,6 @@ public class RadioAccessFamily implements Parcelable { // 5G private static final int NR = RAF_NR; - /** Non-Terrestrial Network. */ - private static final int NB_IOT_NTN = RAF_NB_IOT_NTN; - /* Phone ID of phone */ private int mPhoneId; @@ -264,7 +258,7 @@ public class RadioAccessFamily implements Parcelable { raf = ((EVDO & raf) > 0) ? (EVDO | raf) : raf; raf = ((LTE & raf) > 0) ? (LTE | raf) : raf; raf = ((NR & raf) > 0) ? (NR | raf) : raf; - raf = ((NB_IOT_NTN & raf) > 0) ? (NB_IOT_NTN | raf) : raf; + return raf; } @@ -370,7 +364,6 @@ public class RadioAccessFamily implements Parcelable { case "WCDMA": return WCDMA; case "LTE_CA": return RAF_LTE_CA; case "NR": return RAF_NR; - case "NB_IOT_NTN": return RAF_NB_IOT_NTN; default: return RAF_UNKNOWN; } } diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java index f8c3287fec36..127bbff01575 100644 --- a/telephony/java/android/telephony/ServiceState.java +++ b/telephony/java/android/telephony/ServiceState.java @@ -233,12 +233,6 @@ public class ServiceState implements Parcelable { public static final int RIL_RADIO_TECHNOLOGY_NR = 20; /** - * 3GPP NB-IOT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. - * @hide - */ - public static final int RIL_RADIO_TECHNOLOGY_NB_IOT_NTN = 21; - - /** * RIL Radio Annotation * @hide */ @@ -264,16 +258,14 @@ public class ServiceState implements Parcelable { ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA, ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN, ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA, - ServiceState.RIL_RADIO_TECHNOLOGY_NR, - ServiceState.RIL_RADIO_TECHNOLOGY_NB_IOT_NTN - }) + ServiceState.RIL_RADIO_TECHNOLOGY_NR}) public @interface RilRadioTechnology {} /** * The number of the radio technologies. */ - private static final int NEXT_RIL_RADIO_TECHNOLOGY = 22; + private static final int NEXT_RIL_RADIO_TECHNOLOGY = 21; /** @hide */ public static final int RIL_RADIO_CDMA_TECHNOLOGY_BITMASK = @@ -1133,9 +1125,6 @@ public class ServiceState implements Parcelable { case RIL_RADIO_TECHNOLOGY_NR: rtString = "NR_SA"; break; - case RIL_RADIO_TECHNOLOGY_NB_IOT_NTN: - rtString = "NB_IOT_NTN"; - break; default: rtString = "Unexpected"; Rlog.w(LOG_TAG, "Unexpected radioTechnology=" + rt); @@ -1679,8 +1668,6 @@ public class ServiceState implements Parcelable { return TelephonyManager.NETWORK_TYPE_LTE_CA; case RIL_RADIO_TECHNOLOGY_NR: return TelephonyManager.NETWORK_TYPE_NR; - case RIL_RADIO_TECHNOLOGY_NB_IOT_NTN: - return TelephonyManager.NETWORK_TYPE_NB_IOT_NTN; default: return TelephonyManager.NETWORK_TYPE_UNKNOWN; } @@ -1710,7 +1697,6 @@ public class ServiceState implements Parcelable { return AccessNetworkType.CDMA2000; case RIL_RADIO_TECHNOLOGY_LTE: case RIL_RADIO_TECHNOLOGY_LTE_CA: - case RIL_RADIO_TECHNOLOGY_NB_IOT_NTN: return AccessNetworkType.EUTRAN; case RIL_RADIO_TECHNOLOGY_NR: return AccessNetworkType.NGRAN; @@ -1771,8 +1757,6 @@ public class ServiceState implements Parcelable { return RIL_RADIO_TECHNOLOGY_LTE_CA; case TelephonyManager.NETWORK_TYPE_NR: return RIL_RADIO_TECHNOLOGY_NR; - case TelephonyManager.NETWORK_TYPE_NB_IOT_NTN: - return RIL_RADIO_TECHNOLOGY_NB_IOT_NTN; default: return RIL_RADIO_TECHNOLOGY_UNKNOWN; } @@ -1882,8 +1866,7 @@ public class ServiceState implements Parcelable { || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA || radioTechnology == RIL_RADIO_TECHNOLOGY_IWLAN || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE_CA - || radioTechnology == RIL_RADIO_TECHNOLOGY_NR - || radioTechnology == RIL_RADIO_TECHNOLOGY_NB_IOT_NTN; + || radioTechnology == RIL_RADIO_TECHNOLOGY_NR; } @@ -1903,8 +1886,7 @@ public class ServiceState implements Parcelable { public static boolean isPsOnlyTech(int radioTechnology) { return radioTechnology == RIL_RADIO_TECHNOLOGY_LTE || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE_CA - || radioTechnology == RIL_RADIO_TECHNOLOGY_NR - || radioTechnology == RIL_RADIO_TECHNOLOGY_NB_IOT_NTN; + || radioTechnology == RIL_RADIO_TECHNOLOGY_NR; } /** @hide */ diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 9694b90f06a5..24fb8c5da2d7 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -3197,12 +3197,6 @@ public class TelephonyManager { * For 5G NSA, the network type will be {@link #NETWORK_TYPE_LTE}. */ public static final int NETWORK_TYPE_NR = TelephonyProtoEnums.NETWORK_TYPE_NR; // 20. - /** - * 3GPP NB-IOT (Narrowband Internet of Things) over Non-Terrestrial-Networks technology. - */ - @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS) - public static final int NETWORK_TYPE_NB_IOT_NTN = - TelephonyProtoEnums.NETWORK_TYPE_NB_IOT_NTN; // 21 private static final @NetworkType int[] NETWORK_TYPES = { NETWORK_TYPE_GPRS, @@ -3279,7 +3273,6 @@ public class TelephonyManager { * @see #NETWORK_TYPE_EHRPD * @see #NETWORK_TYPE_HSPAP * @see #NETWORK_TYPE_NR - * @see #NETWORK_TYPE_NB_IOT_NTN * * @hide */ @@ -3340,7 +3333,6 @@ public class TelephonyManager { * @see #NETWORK_TYPE_EHRPD * @see #NETWORK_TYPE_HSPAP * @see #NETWORK_TYPE_NR - * @see #NETWORK_TYPE_NB_IOT_NTN * * @throws UnsupportedOperationException If the device does not have * {@link PackageManager#FEATURE_TELEPHONY_RADIO_ACCESS}. @@ -3491,8 +3483,6 @@ public class TelephonyManager { return "LTE_CA"; case NETWORK_TYPE_NR: return "NR"; - case NETWORK_TYPE_NB_IOT_NTN: - return "NB_IOT_NTN"; case NETWORK_TYPE_UNKNOWN: return "UNKNOWN"; default: @@ -3543,8 +3533,6 @@ public class TelephonyManager { return NETWORK_TYPE_BITMASK_LTE; case NETWORK_TYPE_NR: return NETWORK_TYPE_BITMASK_NR; - case NETWORK_TYPE_NB_IOT_NTN: - return NETWORK_TYPE_BITMASK_NB_IOT_NTN; case NETWORK_TYPE_IWLAN: return NETWORK_TYPE_BITMASK_IWLAN; case NETWORK_TYPE_IDEN: @@ -10339,9 +10327,6 @@ public class TelephonyManager { * This API will result in allowing an intersection of allowed network types for all reasons, * including the configuration done through other reasons. * - * If device supports satellite service, then - * {@link #NETWORK_TYPE_NB_IOT_NTN} is added to allowed network types for reason by default. - * * @param reason the reason the allowed network type change is taking place * @param allowedNetworkTypes The bitmask of allowed network type * @throws IllegalStateException if the Telephony process is not currently available. @@ -10391,10 +10376,6 @@ public class TelephonyManager { * <p>Requires permission: android.Manifest.READ_PRIVILEGED_PHONE_STATE or * that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}). * - * If device supports satellite service, then - * {@link #NETWORK_TYPE_NB_IOT_NTN} is added to allowed network types for reason by - * default. - * * @param reason the reason the allowed network type change is taking place * @return the allowed network type bitmask * @throws IllegalStateException if the Telephony process is not currently available. @@ -10461,7 +10442,7 @@ public class TelephonyManager { */ public static String convertNetworkTypeBitmaskToString( @NetworkTypeBitMask long networkTypeBitmask) { - String networkTypeName = IntStream.rangeClosed(NETWORK_TYPE_GPRS, NETWORK_TYPE_NB_IOT_NTN) + String networkTypeName = IntStream.rangeClosed(NETWORK_TYPE_GPRS, NETWORK_TYPE_NR) .filter(x -> { return (networkTypeBitmask & getBitMaskForNetworkType(x)) == getBitMaskForNetworkType(x); @@ -15143,8 +15124,7 @@ public class TelephonyManager { NETWORK_TYPE_BITMASK_LTE_CA, NETWORK_TYPE_BITMASK_NR, NETWORK_TYPE_BITMASK_IWLAN, - NETWORK_TYPE_BITMASK_IDEN, - NETWORK_TYPE_BITMASK_NB_IOT_NTN + NETWORK_TYPE_BITMASK_IDEN }) public @interface NetworkTypeBitMask {} @@ -15251,12 +15231,6 @@ public class TelephonyManager { */ public static final long NETWORK_TYPE_BITMASK_IWLAN = (1 << (NETWORK_TYPE_IWLAN -1)); - /** - * network type bitmask indicating the support of readio tech NB IOT NTN. - */ - @FlaggedApi(Flags.FLAG_SATELLITE_SYSTEM_APIS) - public static final long NETWORK_TYPE_BITMASK_NB_IOT_NTN = (1 << (NETWORK_TYPE_NB_IOT_NTN - 1)); - /** @hide */ public static final long NETWORK_CLASS_BITMASK_2G = NETWORK_TYPE_BITMASK_GSM | NETWORK_TYPE_BITMASK_GPRS @@ -15285,9 +15259,6 @@ public class TelephonyManager { public static final long NETWORK_CLASS_BITMASK_5G = NETWORK_TYPE_BITMASK_NR; /** @hide */ - public static final long NETWORK_CLASS_BITMASK_NTN = NETWORK_TYPE_BITMASK_NB_IOT_NTN; - - /** @hide */ public static final long NETWORK_STANDARDS_FAMILY_BITMASK_3GPP = NETWORK_TYPE_BITMASK_GSM | NETWORK_TYPE_BITMASK_GPRS | NETWORK_TYPE_BITMASK_EDGE @@ -15299,8 +15270,7 @@ public class TelephonyManager { | NETWORK_TYPE_BITMASK_TD_SCDMA | NETWORK_TYPE_BITMASK_LTE | NETWORK_TYPE_BITMASK_LTE_CA - | NETWORK_TYPE_BITMASK_NR - | NETWORK_TYPE_BITMASK_NB_IOT_NTN; + | NETWORK_TYPE_BITMASK_NR; /** @hide * @deprecated Legacy CDMA is unsupported. @@ -18341,7 +18311,7 @@ public class TelephonyManager { */ public static boolean isNetworkTypeValid(@NetworkType int networkType) { return networkType >= TelephonyManager.NETWORK_TYPE_UNKNOWN && - networkType <= TelephonyManager.NETWORK_TYPE_NB_IOT_NTN; + networkType <= TelephonyManager.NETWORK_TYPE_NR; } /** |