Merge "Modify handling of notifs with invalid sounds" into tm-dev am: 08f603903c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17665297
Change-Id: I562e1ecba2dcbeefacce87345fc554cd0316dda8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/core/res/res/values-en-rXC/strings.xml b/core/res/res/values-en-rXC/strings.xml
index 03511cc..b14c243 100644
--- a/core/res/res/values-en-rXC/strings.xml
+++ b/core/res/res/values-en-rXC/strings.xml
@@ -1933,36 +1933,21 @@
<string name="app_blocked_message" msgid="542972921087873023">"<xliff:g id="APP_NAME">%1$s</xliff:g> is not available right now."</string>
<string name="app_streaming_blocked_title" msgid="6090945835898766139">"<xliff:g id="ACTIVITY">%1$s</xliff:g> unavailable"</string>
<string name="app_streaming_blocked_title_for_permission_dialog" msgid="4483161748582966785">"Permission needed"</string>
- <!-- no translation found for app_streaming_blocked_title_for_camera_dialog (3935701653713853065) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_title_for_fingerprint_dialog (3516853717714141951) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_title_for_microphone_dialog (544822455127171206) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_title_for_settings_dialog (196994247017450357) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_title_for_settings_dialog (8222710146267948647) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_title_for_settings_dialog (6895719984375299791) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message (5024599278277957935) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message (7491114163056552686) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message (1245180131667647277) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_permission_dialog (6306583663205997979) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_permission_dialog (6545624942642129664) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_permission_dialog (8462740631707923000) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_fingerprint_dialog (3470977315395784567) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_fingerprint_dialog (698460091901465092) -->
- <skip />
- <!-- no translation found for app_streaming_blocked_message_for_fingerprint_dialog (8552691971910603907) -->
- <skip />
+ <string name="app_streaming_blocked_title_for_camera_dialog" msgid="3935701653713853065">"Camera unavailable"</string>
+ <string name="app_streaming_blocked_title_for_fingerprint_dialog" msgid="3516853717714141951">"Continue on phone"</string>
+ <string name="app_streaming_blocked_title_for_microphone_dialog" msgid="544822455127171206">"Microphone unavailable"</string>
+ <string name="app_streaming_blocked_title_for_settings_dialog" product="tv" msgid="196994247017450357">"Android TV settings unavailable"</string>
+ <string name="app_streaming_blocked_title_for_settings_dialog" product="tablet" msgid="8222710146267948647">"Tablet settings unavailable"</string>
+ <string name="app_streaming_blocked_title_for_settings_dialog" product="default" msgid="6895719984375299791">"Phone settings unavailable"</string>
+ <string name="app_streaming_blocked_message" product="tv" msgid="5024599278277957935">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g>. Try on your Android TV device instead."</string>
+ <string name="app_streaming_blocked_message" product="tablet" msgid="7491114163056552686">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g>. Try on your tablet instead."</string>
+ <string name="app_streaming_blocked_message" product="default" msgid="1245180131667647277">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g>. Try on your phone instead."</string>
+ <string name="app_streaming_blocked_message_for_permission_dialog" product="tv" msgid="6306583663205997979">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g> at this time. Try on your Android TV device instead."</string>
+ <string name="app_streaming_blocked_message_for_permission_dialog" product="tablet" msgid="6545624942642129664">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g> at this time. Try on your tablet instead."</string>
+ <string name="app_streaming_blocked_message_for_permission_dialog" product="default" msgid="8462740631707923000">"This can’t be accessed on your <xliff:g id="DEVICE">%1$s</xliff:g> at this time. Try on your phone instead."</string>
+ <string name="app_streaming_blocked_message_for_fingerprint_dialog" product="tv" msgid="3470977315395784567">"This app is requesting additional security. Try on your Android TV device instead."</string>
+ <string name="app_streaming_blocked_message_for_fingerprint_dialog" product="tablet" msgid="698460091901465092">"This app is requesting additional security. Try on your tablet instead."</string>
+ <string name="app_streaming_blocked_message_for_fingerprint_dialog" product="default" msgid="8552691971910603907">"This app is requesting additional security. Try on your phone instead."</string>
<string name="deprecated_target_sdk_message" msgid="5203207875657579953">"This app was built for an older version of Android and may not work properly. Try checking for updates, or contact the developer."</string>
<string name="deprecated_target_sdk_app_store" msgid="8456784048558808909">"Check for update"</string>
<string name="new_sms_notification_title" msgid="6528758221319927107">"You have new messages"</string>
diff --git a/packages/SettingsLib/res/values-en-rXC/strings.xml b/packages/SettingsLib/res/values-en-rXC/strings.xml
index 9ca21bb..70227dc 100644
--- a/packages/SettingsLib/res/values-en-rXC/strings.xml
+++ b/packages/SettingsLib/res/values-en-rXC/strings.xml
@@ -655,12 +655,8 @@
<string name="bt_le_audio_scan_qr_code" msgid="3521809854780392679">"Scan QR code"</string>
<string name="bt_le_audio_scan_qr_code_scanner" msgid="4679500020630341107">"To start listening, center the QR code below"</string>
<string name="bt_le_audio_qr_code_is_not_valid_format" msgid="6092191081849434734">"QR code isn\'t a valid format"</string>
- <!-- no translation found for bt_le_audio_broadcast_dialog_title (5392738488989777074) -->
- <skip />
- <!-- no translation found for bt_le_audio_broadcast_dialog_sub_title (268234802198852753) -->
- <skip />
- <!-- no translation found for bt_le_audio_broadcast_dialog_switch_app (5749813313369517812) -->
- <skip />
- <!-- no translation found for bt_le_audio_broadcast_dialog_different_output (2638402023060391333) -->
- <skip />
+ <string name="bt_le_audio_broadcast_dialog_title" msgid="5392738488989777074">"Stop broadcasting <xliff:g id="APP_NAME">%1$s</xliff:g>?"</string>
+ <string name="bt_le_audio_broadcast_dialog_sub_title" msgid="268234802198852753">"If you broadcast <xliff:g id="SWITCHAPP">%1$s</xliff:g> or change the output, your current broadcast will stop"</string>
+ <string name="bt_le_audio_broadcast_dialog_switch_app" msgid="5749813313369517812">"Broadcast <xliff:g id="SWITCHAPP">%1$s</xliff:g>"</string>
+ <string name="bt_le_audio_broadcast_dialog_different_output" msgid="2638402023060391333">"Change output"</string>
</resources>
diff --git a/packages/SystemUI/res/values-bg/strings.xml b/packages/SystemUI/res/values-bg/strings.xml
index 6fabe3f..97f1d60 100644
--- a/packages/SystemUI/res/values-bg/strings.xml
+++ b/packages/SystemUI/res/values-bg/strings.xml
@@ -27,7 +27,7 @@
<string name="invalid_charger_title" msgid="938685362320735167">"Зареждането през USB не е възможно"</string>
<string name="invalid_charger_text" msgid="2339310107232691577">"Използвайте оригиналното зарядно устройство"</string>
<string name="battery_saver_confirmation_title" msgid="1234998463717398453">"Да се включи ли режимът за запазване на батерията?"</string>
- <string name="battery_saver_confirmation_title_generic" msgid="2299231884234959849">"Всичко за режима за запазване на батерията"</string>
+ <string name="battery_saver_confirmation_title_generic" msgid="2299231884234959849">"За режима за запазване на батерията"</string>
<string name="battery_saver_confirmation_ok" msgid="5042136476802816494">"Включване"</string>
<string name="battery_saver_start_action" msgid="8353766979886287140">"Включване"</string>
<string name="battery_saver_dismiss_action" msgid="7199342621040014738">"Не, благодаря"</string>
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
index abff914..0f3ef64 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
@@ -318,7 +318,7 @@
};
private final Consumer<Boolean> mNavbarOverlayVisibilityChangeCallback = (visible) -> {
- if (visible && mAutoHideController != null) {
+ if (visible) {
mAutoHideController.touchAutoHide();
}
notifyActiveTouchRegions();
diff --git a/services/backup/java/com/android/server/backup/restore/FullRestoreEngine.java b/services/backup/java/com/android/server/backup/restore/FullRestoreEngine.java
index e78c8d1..76df8b9 100644
--- a/services/backup/java/com/android/server/backup/restore/FullRestoreEngine.java
+++ b/services/backup/java/com/android/server/backup/restore/FullRestoreEngine.java
@@ -24,10 +24,8 @@
import static com.android.server.backup.UserBackupManagerService.SHARED_BACKUP_AGENT_PACKAGE;
import static com.android.server.backup.internal.BackupHandler.MSG_RESTORE_OPERATION_TIMEOUT;
-import android.annotation.NonNull;
import android.app.ApplicationThreadConstants;
import android.app.IBackupAgent;
-import android.app.backup.BackupAgent;
import android.app.backup.BackupManager;
import android.app.backup.FullBackup;
import android.app.backup.IBackupManagerMonitor;
@@ -40,12 +38,10 @@
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.provider.Settings;
-import android.system.OsConstants;
import android.text.TextUtils;
import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
-import com.android.internal.annotations.VisibleForTesting;
import com.android.server.LocalServices;
import com.android.server.backup.BackupAgentTimeoutParameters;
import com.android.server.backup.BackupRestoreTask;
@@ -61,7 +57,6 @@
import com.android.server.backup.utils.RestoreUtils;
import com.android.server.backup.utils.TarBackupReader;
-import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -140,8 +135,6 @@
private boolean mPipesClosed;
private final BackupEligibilityRules mBackupEligibilityRules;
- private FileMetadata mReadOnlyParent = null;
-
public FullRestoreEngine(
UserBackupManagerService backupManagerService, OperationStorage operationStorage,
BackupRestoreTask monitorTask, IFullBackupRestoreObserver observer,
@@ -165,22 +158,6 @@
mBackupEligibilityRules = backupEligibilityRules;
}
- @VisibleForTesting
- FullRestoreEngine() {
- mIsAdbRestore = false;
- mAllowApks = false;
- mEphemeralOpToken = 0;
- mUserId = 0;
- mBackupEligibilityRules = null;
- mAgentTimeoutParameters = null;
- mBuffer = null;
- mBackupManagerService = null;
- mOperationStorage = null;
- mMonitor = null;
- mMonitorTask = null;
- mOnlyPackage = null;
- }
-
public IBackupAgent getAgent() {
return mAgent;
}
@@ -420,11 +397,6 @@
okay = false;
}
- if (shouldSkipReadOnlyDir(info)) {
- // b/194894879: We don't support restore of read-only dirs.
- okay = false;
- }
-
// At this point we have an agent ready to handle the full
// restore data as well as a pipe for sending data to
// that agent. Tell the agent to start reading from the
@@ -601,45 +573,6 @@
return (info != null);
}
- boolean shouldSkipReadOnlyDir(FileMetadata info) {
- if (isValidParent(mReadOnlyParent, info)) {
- // This file has a read-only parent directory, we shouldn't
- // restore it.
- return true;
- } else {
- // We're now in a different branch of the file tree, update the parent
- // value.
- if (isReadOnlyDir(info)) {
- // Current directory is read-only. Remember it so that we can skip all
- // of its contents.
- mReadOnlyParent = info;
- Slog.w(TAG, "Skipping restore of " + info.path + " and its contents as "
- + "read-only dirs are currently not supported.");
- return true;
- } else {
- mReadOnlyParent = null;
- }
- }
-
- return false;
- }
-
- private static boolean isValidParent(FileMetadata parentDir, @NonNull FileMetadata childDir) {
- return parentDir != null
- && childDir.packageName.equals(parentDir.packageName)
- && childDir.domain.equals(parentDir.domain)
- && childDir.path.startsWith(getPathWithTrailingSeparator(parentDir.path));
- }
-
- private static String getPathWithTrailingSeparator(String path) {
- return path.endsWith(File.separator) ? path : path + File.separator;
- }
-
- private static boolean isReadOnlyDir(FileMetadata file) {
- // Check if owner has 'write' bit in the file's mode value (see 'man -7 inode' for details).
- return file.type == BackupAgent.TYPE_DIRECTORY && (file.mode & OsConstants.S_IWUSR) == 0;
- }
-
private void setUpPipes() throws IOException {
synchronized (mPipesLock) {
mPipes = ParcelFileDescriptor.createPipe();
diff --git a/services/tests/servicestests/src/com/android/server/backup/restore/FullRestoreEngineTest.java b/services/tests/servicestests/src/com/android/server/backup/restore/FullRestoreEngineTest.java
deleted file mode 100644
index 049c745..0000000
--- a/services/tests/servicestests/src/com/android/server/backup/restore/FullRestoreEngineTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.server.backup.restore;
-
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import android.app.backup.BackupAgent;
-import android.platform.test.annotations.Presubmit;
-import android.system.OsConstants;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.server.backup.FileMetadata;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@Presubmit
-@RunWith(AndroidJUnit4.class)
-public class FullRestoreEngineTest {
- private static final String DEFAULT_PACKAGE_NAME = "package";
- private static final String DEFAULT_DOMAIN_NAME = "domain";
- private static final String NEW_PACKAGE_NAME = "new_package";
- private static final String NEW_DOMAIN_NAME = "new_domain";
-
- private FullRestoreEngine mRestoreEngine;
-
- @Before
- public void setUp() {
- mRestoreEngine = new FullRestoreEngine();
- }
-
- @Test
- public void shouldSkipReadOnlyDir_skipsAllReadonlyDirsAndTheirChildren() {
- // Create the file tree.
- TestFile[] testFiles = new TestFile[] {
- TestFile.dir("root"),
- TestFile.file("root/auth_token"),
- TestFile.dir("root/media"),
- TestFile.file("root/media/picture1.png"),
- TestFile.file("root/push_token.txt"),
- TestFile.dir("root/read-only-dir-1").markReadOnly().expectSkipped(),
- TestFile.dir("root/read-only-dir-1/writable-subdir").expectSkipped(),
- TestFile.file("root/read-only-dir-1/writable-subdir/writable-file").expectSkipped(),
- TestFile.dir("root/read-only-dir-1/writable-subdir/read-only-subdir-2")
- .markReadOnly().expectSkipped(),
- TestFile.file("root/read-only-dir-1/writable-file").expectSkipped(),
- TestFile.file("root/random-stuff.txt"),
- TestFile.dir("root/database"),
- TestFile.file("root/database/users.db"),
- TestFile.dir("root/read-only-dir-2").markReadOnly().expectSkipped(),
- TestFile.file("root/read-only-dir-2/writable-file-1").expectSkipped(),
- TestFile.file("root/read-only-dir-2/writable-file-2").expectSkipped(),
- };
-
- assertCorrectItemsAreSkipped(testFiles);
- }
-
- @Test
- public void shouldSkipReadOnlyDir_onlySkipsChildrenUnderTheSamePackage() {
- TestFile[] testFiles = new TestFile[]{
- TestFile.dir("read-only-dir").markReadOnly().expectSkipped(),
- TestFile.file("read-only-dir/file").expectSkipped(),
- TestFile.file("read-only-dir/file-from-different-package")
- .setPackage(NEW_PACKAGE_NAME),
- };
-
- assertCorrectItemsAreSkipped(testFiles);
- }
-
- @Test
- public void shouldSkipReadOnlyDir_onlySkipsChildrenUnderTheSameDomain() {
- TestFile[] testFiles = new TestFile[]{
- TestFile.dir("read-only-dir").markReadOnly().expectSkipped(),
- TestFile.file("read-only-dir/file").expectSkipped(),
- TestFile.file("read-only-dir/file-from-different-domain")
- .setDomain(NEW_DOMAIN_NAME),
- };
-
- assertCorrectItemsAreSkipped(testFiles);
- }
-
- private void assertCorrectItemsAreSkipped(TestFile[] testFiles) {
- // Verify all directories marked with .expectSkipped are skipped.
- for (TestFile testFile : testFiles) {
- boolean actualExcluded = mRestoreEngine.shouldSkipReadOnlyDir(testFile.mMetadata);
- boolean expectedExcluded = testFile.mShouldSkip;
- assertWithMessage(testFile.mMetadata.path).that(actualExcluded).isEqualTo(
- expectedExcluded);
- }
- }
-
- private static class TestFile {
- private final FileMetadata mMetadata;
- private boolean mShouldSkip;
-
- static TestFile dir(String path) {
- return new TestFile(path, BackupAgent.TYPE_DIRECTORY);
- }
-
- static TestFile file(String path) {
- return new TestFile(path, BackupAgent.TYPE_FILE);
- }
-
- TestFile markReadOnly() {
- mMetadata.mode = 0;
- return this;
- }
-
- TestFile expectSkipped() {
- mShouldSkip = true;
- return this;
- }
-
- TestFile setPackage(String packageName) {
- mMetadata.packageName = packageName;
- return this;
- }
-
- TestFile setDomain(String domain) {
- mMetadata.domain = domain;
- return this;
- }
-
- private TestFile(String path, int type) {
- FileMetadata metadata = new FileMetadata();
- metadata.path = path;
- metadata.type = type;
- metadata.packageName = DEFAULT_PACKAGE_NAME;
- metadata.domain = DEFAULT_DOMAIN_NAME;
- metadata.mode = OsConstants.S_IWUSR; // Mark as writable.
- mMetadata = metadata;
- }
- }
-}