3 # Copyright (C) 2009 The Android Open Source Project
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # uncomment for debugging
18 #export DRY_RUN="echo"
19 source test_backup_common.sh
21 # figure out what packages are participating in backup
22 b_pkgs=$(a shell dumpsys backup | \
23 ruby -e 'p_stanza = STDIN.read.match(/Participants:.*?(?=Ever)/m)[0]
24 puts p_stanza.scan(/^ (.+?)\s*$/).flatten.join(" ")')
26 # wipe data for the package participating in backup
27 for pkg in $b_pkgs; do
28 a shell bmgr wipe "$pkg"
31 echo 'Waiting 5 seconds for things to settle...'
34 # run adb as root so we can poke at com.android.backuptest's data
37 # show commands as we go
41 #a shell bmgr transport com.google.android.backup/.BackupTransportService
43 # load up the three files
45 "rm /data/data/com.android.backuptest/files/file.txt ; \
46 rm /data/data/com.android.backuptest/files/another_file.txt ; \
47 rm /data/data/com.android.backuptest/files/empty.txt ; \
48 mkdir /data/data/com.android.backuptest ; \
49 mkdir /data/data/com.android.backuptest/files ; \
50 mkdir /data/data/com.android.backuptest/shared_prefs ; \
51 echo -n \"<map><int name=\\\"pref\\\" value=\\\"1\\\" /></map>\" \
52 > /data/data/com.android.backuptest/shared_prefs/raw.xml ; \
53 echo -n first file > /data/data/com.android.backuptest/files/file.txt ; \
54 echo -n asdf > /data/data/com.android.backuptest/files/another_file.txt ; \
55 echo -n "" > /data/data/com.android.backuptest/files/empty.txt ; \
56 date >> /data/data/com.android.backuptest/files/3.txt ; \
58 # echo -n 3 > /data/data/com.android.backuptest/files/3.txt ; \
60 # say that the data has changed
61 a shell bmgr backup com.android.backuptest