[android-porting] How to save property and data for applications in Android

68 views
Skip to first unread message

Qipeng

unread,
Apr 15, 2010, 10:55:48 PM4/15/10
to android-porting
Hello, everyone.

I have already ported my Android, but there is a new problem that the
property of the application is set, and after rebooting, the property
is gone! So I have to set them all again and again only if I reboot
the device, such as the WiFi in setting.

The problem is so boring that I must solve it I think. And at the same
time I also want to know how it does in other products like GPhone.

(1) how to save the property and data for applications to make them
not be removed after reboot.
(2) why the property and data are needed to be removed on booting
Android system.

The logcat message is as followed, and it shows that the settings are
all removed on booting.

「Logcat」
I/PackageManager( 760): /system/app/Settings.apk changed; collecting
certs
D/dalvikvm( 760): GC freed 9774 objects / 638616 bytes in 219ms
W/PackageManager( 760): System package com.android.settings has
changed from uid: 0 to 1000; old data erased
I/PackageManager( 760): /system/app/Settings.apk changed; unpacking

When searching the source code, I find the processing about the
package, where the data is deleted.

./frameworks/base/services/java/com/android/server/
PackageManagerService.java

2033 boolean recovered = false;
2034 if
((parseFlags&PackageParser.PARSE_IS_SYSTEM) != 0) {
          ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
2035 // If this is a system app, we can at
least delete its
2036 // current data so the application will
still work.
2037 if (mInstaller != null) {
2038 int ret = mInstaller.remove(pkgName);
          ▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲▲
2039
2040 if(ret >= 0) {
2041 // Old data gone!
2042 String msg = "System package " +
pkg.packageName
2043 + " has changed from uid:
"
2044 + mOutPermissions[1] + "
to "
2045 + pkg.applicationInfo.uid
+ "; old data erased";
2046 reportSettingsProblem(Log.WARN,
msg);
2047 recovered = true;

Any advices are appreciated. Thank you very much.

Best Regards.

--
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting
Reply all
Reply to author
Forward
0 new messages