Skip to content

Commit c58cf7d

Browse files
author
Christopher Tate
committed
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
1 parent 651cdfc commit c58cf7d

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

packages/BackupRestoreConfirmation/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
android:permission="android.permission.CONFIRM_FULL_BACKUP" >
2626

2727
<activity android:name=".BackupRestoreConfirmation"
28+
android:title=""
2829
android:windowSoftInputMode="stateAlwaysHidden"
2930
android:excludeFromRecents="true"
3031
android:exported="true" >

packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2222
android:layout_width="match_parent"
2323
android:layout_height="match_parent"
24-
android:orientation="vertical"
25-
android:padding="16dp" >
24+
android:orientation="vertical">
2625

2726
<ScrollView
27+
android:padding="16dp"
2828
android:layout_height="0dp"
2929
android:layout_weight="1"
3030
android:layout_width="match_parent">

packages/BackupRestoreConfirmation/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
limitations under the License.
1515
-->
1616
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
17+
<!-- Title of the activity when a full backup has been requested and must be confirmed -->
18+
<string name="backup_confirm_title">Full backup</string>
19+
<!-- Title of the activity when a full restore has been requested and must be confirmed -->
20+
<string name="restore_confirm_title">Full restore</string>
1721

1822
<!-- Text for message to user that a full backup has been requested, and must be confirmed. -->
1923
<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>

packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,13 @@ public void onCreate(Bundle icicle) {
131131
final String action = intent.getAction();
132132

133133
final int layoutId;
134+
final int titleId;
134135
if (action.equals(FullBackup.FULL_BACKUP_INTENT_ACTION)) {
135136
layoutId = R.layout.confirm_backup;
137+
titleId = R.string.backup_confirm_title;
136138
} else if (action.equals(FullBackup.FULL_RESTORE_INTENT_ACTION)) {
137139
layoutId = R.layout.confirm_restore;
140+
titleId = R.string.restore_confirm_title;
138141
} else {
139142
Slog.w(TAG, "Backup/restore confirmation activity launched with invalid action!");
140143
finish();
@@ -159,6 +162,7 @@ public void onCreate(Bundle icicle) {
159162
mObserver.setHandler(mHandler);
160163
}
161164

165+
setTitle(titleId);
162166
setContentView(layoutId);
163167

164168
// Same resource IDs for each layout variant (backup / restore)

0 commit comments

Comments
 (0)