923 // User or Preinstaller is making an update, |
923 // User or Preinstaller is making an update, |
924 // do not change preinstall state. |
924 // do not change preinstall state. |
925 } |
925 } |
926 else |
926 else |
927 { |
927 { |
928 // Not an update ==> suite is being uninstalled. |
928 // Not an update ==> user is making uninstallation. |
929 int oldPreinstallState = readPreinstallState(aSuiteInfo); |
929 int oldPreinstallState = readPreinstallState(aSuiteInfo); |
930 if (oldPreinstallState == aSuiteInfo.STATE_PREINSTALLED) |
930 if (oldPreinstallState == aSuiteInfo.STATE_PREINSTALLED) |
931 { |
931 { |
932 if (aSuiteInfo.getResetPreinstall()) |
932 // User is uninstalling a preinstalled application, |
933 { |
933 // set preinstall state to STATE_NO_PREINSTALL. |
934 // Preinstallation state should be reset, |
934 setNoPreinstallState(aSuiteInfo); |
935 // remove existing data from |
|
936 // StorageNames.PREINSTALL_TABLE table. |
|
937 removePreinstallState(aSuiteInfo); |
|
938 } |
|
939 else |
|
940 { |
|
941 // User is uninstalling a preinstalled application, |
|
942 // set preinstall state to STATE_NO_PREINSTALL. |
|
943 setNoPreinstallState(aSuiteInfo); |
|
944 } |
|
945 } |
935 } |
946 else if (oldPreinstallState == aSuiteInfo.STATE_INSTALLED) |
936 else if (oldPreinstallState == aSuiteInfo.STATE_INSTALLED) |
947 { |
937 { |
948 // Remove existing data from StorageNames.PREINSTALL_TABLE table. |
938 // Remove existing data from StorageNames.PREINSTALL_TABLE table. |
949 removePreinstallState(aSuiteInfo); |
939 removePreinstallState(aSuiteInfo); |
1089 iSession.update(StorageNames.PREINSTALL_TABLE, entry, matchEntry); |
1079 iSession.update(StorageNames.PREINSTALL_TABLE, entry, matchEntry); |
1090 } |
1080 } |
1091 |
1081 |
1092 /** |
1082 /** |
1093 * Removes preinstall state for given suite from |
1083 * Removes preinstall state for given suite from |
1094 * preinstall table |
1084 * preinstall table but only if preinstall state |
|
1085 * in given SuiteInfo is SuiteInfo.STATE_INSTALLED. |
1095 */ |
1086 */ |
1096 private void removePreinstallState(SuiteInfo aSuiteInfo) |
1087 private void removePreinstallState(SuiteInfo aSuiteInfo) |
1097 { |
1088 { |
1098 if (aSuiteInfo == null) |
1089 if (aSuiteInfo == null || |
|
1090 aSuiteInfo.iPreinstallState != aSuiteInfo.STATE_INSTALLED) |
1099 { |
1091 { |
1100 return; |
1092 return; |
1101 } |
1093 } |
1102 // Match preinstall state using name and vendor. |
1094 // Match preinstall state using name and vendor. |
1103 StorageEntry matchEntry = new StorageEntry(); |
1095 StorageEntry matchEntry = new StorageEntry(); |