Give backup/restore confirmation a proper window title
Since the confirmation uses the same Activity but different layouts
for the backup vs restore cases, we have to do the title in code.
Along the way, fix the restore layout's padding [the backup layout
was already right].
Fixes bug 5164470
Change-Id: I4d636f666d97fc377e9cf36abf08d1625a05577f
diff --git a/packages/BackupRestoreConfirmation/AndroidManifest.xml b/packages/BackupRestoreConfirmation/AndroidManifest.xml
index 19848f6..f3feee8 100644
--- a/packages/BackupRestoreConfirmation/AndroidManifest.xml
+++ b/packages/BackupRestoreConfirmation/AndroidManifest.xml
@@ -25,6 +25,7 @@
android:permission="android.permission.CONFIRM_FULL_BACKUP" >
<activity android:name=".BackupRestoreConfirmation"
+ android:title=""
android:windowSoftInputMode="stateAlwaysHidden"
android:excludeFromRecents="true"
android:exported="true" >
diff --git a/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml b/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml
index 3522e7c..2ee74fe 100644
--- a/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml
+++ b/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml
@@ -21,10 +21,10 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical"
- android:padding="16dp" >
+ android:orientation="vertical">
<ScrollView
+ android:padding="16dp"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_width="match_parent">
diff --git a/packages/BackupRestoreConfirmation/res/values/strings.xml b/packages/BackupRestoreConfirmation/res/values/strings.xml
index f022e57..e207a98 100644
--- a/packages/BackupRestoreConfirmation/res/values/strings.xml
+++ b/packages/BackupRestoreConfirmation/res/values/strings.xml
@@ -14,6 +14,10 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Title of the activity when a full backup has been requested and must be confirmed -->
+ <string name="backup_confirm_title">Full backup</string>
+ <!-- Title of the activity when a full restore has been requested and must be confirmed -->
+ <string name="restore_confirm_title">Full restore</string>
<!-- Text for message to user that a full backup has been requested, and must be confirmed. -->
<string name="backup_confirm_text">A full backup of all data to a connected desktop computer has been requested. Do you want to allow this to happen\?\n\nIf you did not request the backup yourself, do not allow the operation to proceed.</string>
diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
index 5448e0b..d053f29 100644
--- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
+++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
@@ -131,10 +131,13 @@
final String action = intent.getAction();
final int layoutId;
+ final int titleId;
if (action.equals(FullBackup.FULL_BACKUP_INTENT_ACTION)) {
layoutId = R.layout.confirm_backup;
+ titleId = R.string.backup_confirm_title;
} else if (action.equals(FullBackup.FULL_RESTORE_INTENT_ACTION)) {
layoutId = R.layout.confirm_restore;
+ titleId = R.string.restore_confirm_title;
} else {
Slog.w(TAG, "Backup/restore confirmation activity launched with invalid action!");
finish();
@@ -159,6 +162,7 @@
mObserver.setHandler(mHandler);
}
+ setTitle(titleId);
setContentView(layoutId);
// Same resource IDs for each layout variant (backup / restore)