diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:34 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 14:04:34 -0800 |
commit | 8b1096d1ada329a296059ccff04e5d78eefa77c1 (patch) | |
tree | a19c8e308b038105a4294825c97d30ec667a184e | |
parent | 2fa4ad8141ed0cb686c7acab27f01e8c2bc2877a (diff) | |
download | android_packages_apps_PackageInstaller-8b1096d1ada329a296059ccff04e5d78eefa77c1.tar.gz android_packages_apps_PackageInstaller-8b1096d1ada329a296059ccff04e5d78eefa77c1.tar.bz2 android_packages_apps_PackageInstaller-8b1096d1ada329a296059ccff04e5d78eefa77c1.zip |
auto import from //depot/cupcake/@132589
-rwxr-xr-x | res/layout/install_confirm.xml | 110 | ||||
-rwxr-xr-x | res/layout/uninstall_confirm.xml | 3 | ||||
-rw-r--r-- | res/values-cs/strings.xml | 12 | ||||
-rw-r--r-- | res/values-de/strings.xml | 12 | ||||
-rw-r--r-- | res/values-es/strings.xml | 12 | ||||
-rw-r--r-- | res/values-fr/strings.xml | 12 | ||||
-rw-r--r-- | res/values-it/strings.xml | 14 | ||||
-rw-r--r-- | res/values-ja/strings.xml | 12 | ||||
-rw-r--r-- | res/values-ko/strings.xml | 12 | ||||
-rw-r--r-- | res/values-nb/strings.xml | 6 | ||||
-rw-r--r-- | res/values-nl/strings.xml | 12 | ||||
-rw-r--r-- | res/values-pl/strings.xml | 12 | ||||
-rw-r--r-- | res/values-ru/strings.xml | 12 | ||||
-rw-r--r-- | res/values-zh-rCN/strings.xml | 12 | ||||
-rw-r--r-- | res/values-zh-rTW/strings.xml | 12 | ||||
-rw-r--r-- | res/values/strings.xml | 8 | ||||
-rwxr-xr-x | src/com/android/packageinstaller/InstallAppDone.java | 8 | ||||
-rw-r--r-- | src/com/android/packageinstaller/PackageInstallerActivity.java | 265 | ||||
-rw-r--r-- | src/com/android/packageinstaller/PackageUtil.java | 25 | ||||
-rwxr-xr-x | src/com/android/packageinstaller/UninstallerActivity.java | 85 |
20 files changed, 256 insertions, 400 deletions
diff --git a/res/layout/install_confirm.xml b/res/layout/install_confirm.xml index bfda97dc..bc4fde2a 100755 --- a/res/layout/install_confirm.xml +++ b/res/layout/install_confirm.xml @@ -21,43 +21,46 @@ user before it is installed. --> -<LinearLayout +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="fill_parent"> + android:layout_height="fill_parent" + android:fillViewport="true" + android:background="@color/view_background"> - <include - layout="@layout/app_details" - android:id="@+id/app_snippet"/> - <TextView - android:id="@+id/install_confirm_question" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/install_confirm_question" - android:textAppearance="?android:attr/textAppearanceMedium" - android:paddingTop="20dip" - android:paddingLeft="20dip" - android:paddingBottom="20dip"/> - - <ScrollView + <LinearLayout + android:id="@+id/all_details" android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:fillViewport="true" - android:layout_weight="1"> + android:layout_height="fill_parent" + android:orientation="vertical"> + + <include + layout="@layout/app_details" + android:id="@+id/app_snippet"/> + <TextView + android:id="@+id/install_confirm_question" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_weight="1.0" + android:text="@string/install_confirm_question" + android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="?android:attr/textColorSecondary" + android:paddingTop="20dip" + android:paddingLeft="20dip" + android:paddingBottom="20dip"/> <!-- Security settings description. --> <LinearLayout android:id="@+id/permissions_section" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:layout_marginRight = "2dip" android:orientation="vertical"> <TextView android:id="@+id/security_settings_desc" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" + android:textColor="?android:attr/textColorSecondary" android:paddingTop="20dip" android:paddingLeft="20dip" android:paddingBottom="20dip"/> @@ -69,40 +72,37 @@ android:layout_weight="1.0" android:orientation="vertical"/> </LinearLayout> - </ScrollView> - <!-- OK confirm and cancel buttons. --> - <LinearLayout - android:background="@color/title_background" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:gravity="bottom" - android:paddingTop="4dip" - android:paddingLeft="2dip" - android:paddingRight="2dip" - android:orientation="horizontal"> - <Button - android:id="@+id/ok_button" - android:text="@string/install" - android:layout_width="150dip" - android:paddingLeft="6dip" - android:layout_gravity="left" - android:layout_weight="0.4" - android:layout_height="wrap_content"/> - <!-- Spacer --> - <View - android:id="@+id/buttons_spacer_left" - android:layout_width="0dip" + <!-- OK confirm and cancel buttons. --> + <LinearLayout + android:background="@color/title_background" + android:layout_width="fill_parent" android:layout_height="wrap_content" - android:visibility="gone" - android:layout_weight="0.2" /> - <Button - android:id="@+id/cancel_button" - android:layout_width="150dip" - android:paddingRight="6dip" - android:layout_gravity="right" - android:text="@string/cancel" - android:layout_weight="0.4" - android:layout_height="wrap_content"/> + android:gravity="bottom" + android:orientation="horizontal"> + <Button + android:id="@+id/ok_button" + android:text="@string/install" + android:layout_width="150dip" + android:paddingLeft="6dip" + android:layout_gravity="left" + android:layout_weight="0.4" + android:layout_height="wrap_content"/> + <!-- Spacer --> + <View + android:id="@+id/buttons_spacer_left" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:visibility="gone" + android:layout_weight="0.2" /> + <Button + android:id="@+id/cancel_button" + android:layout_width="150dip" + android:paddingRight="6dip" + android:layout_gravity="right" + android:text="@string/cancel" + android:layout_weight="0.4" + android:layout_height="wrap_content"/> + </LinearLayout> </LinearLayout> -</LinearLayout> +</ScrollView> diff --git a/res/layout/uninstall_confirm.xml b/res/layout/uninstall_confirm.xml index 3f7f18ac..62bd1544 100755 --- a/res/layout/uninstall_confirm.xml +++ b/res/layout/uninstall_confirm.xml @@ -63,9 +63,6 @@ android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" - android:paddingTop="4dip" - android:paddingLeft="2dip" - android:paddingRight="2dip" android:orientation="horizontal"> <Button android:id="@+id/ok_button" diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index 76247bbf..c76ddff1 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Instalace..."</string> <string name="install_done">"Aplikace byla nainstalována"</string> <string name="install_confirm_question">"Chcete tuto aplikaci nainstalovat?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Instalace aplikace se nezdařila"</string> <string name="launch">"Otevřít"</string> <string name="unknown_apps_dlg_title">"Instalace byla zablokována"</string> <string name="unknown_apps_dlg_text">"Váš telefon je z důvodu zabezpečení nastaven tak, aby blokoval instalaci aplikací, které nepocházejí z webu Android Market."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Správa aplikací"</string> <string name="dlg_app_replacement_title">"Nahradit aplikaci"</string> <string name="dlg_app_replacement_statement">"Aplikace, kterou instalujete, nahradí jinou aplikaci."\n\n"Všechna dříve zadaná data uživatelů budou uložena."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Nedostatek místa"</string> <string name="out_of_space_dlg_text">"Aplikaci <xliff:g id="APP_NAME">%1$s</xliff:g> nebylo možné zobrazit. Uvolněte v telefonu nějaké místo a zkuste to znovu."</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Tato aplikace bude odstraněna z vašeho telefonu."</string> <string name="uninstalling">"Probíhá odinstalace..."</string> <string name="uninstall_done">"Odinstalace byla dokončena."</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Odinstalace aplikace se nezdařila."</string> <string name="Parse_error_dlg_title">"Chyba analýzy"</string> <string name="Parse_error_dlg_text">"Při analýze balíčku došlo k problému."</string> </resources> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 85eb053e..1e5607e2 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Installation..."</string> <string name="install_done">"Anwendung installiert"</string> <string name="install_confirm_question">"Möchten Sie diese Anwendung installieren?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Installation der Anwendung nicht erfolgreich"</string> <string name="launch">"Öffnen"</string> <string name="unknown_apps_dlg_title">"Installation gesperrt"</string> <string name="unknown_apps_dlg_text">"Aus Sicherheitsgründen ist Ihr Telefon so eingestellt, dass die Installation von Nicht-Android Market-Anwendungen gesperrt ist."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Anwendungen verwalten"</string> <string name="dlg_app_replacement_title">"Anwendung ersetzen"</string> <string name="dlg_app_replacement_statement">"Die zu installierende Anwendung ersetzt eine andere Anwendung."\n\n"Alle vorhandenen Nutzerdaten werden gespeichert."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Kein freier Speicher vorhanden"</string> <string name="out_of_space_dlg_text">"<xliff:g id="APP_NAME">%1$s</xliff:g> konnte nicht geprüft werden. Bereinigen Sie den Speicher Ihres Telefons und versuchen Sie es erneut."</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Diese Anwendung wird von Ihrem Telefon entfernt."</string> <string name="uninstalling">"Deinstallation..."</string> <string name="uninstall_done">"Deinstallation abgeschlossen!"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Deinstallierung der Anwendung fehlgeschlagen"</string> <string name="Parse_error_dlg_title">"Parsingfehler"</string> <string name="Parse_error_dlg_text">"Beim Parsen des Pakets ist ein Problem aufgetreten."</string> </resources> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index a75f36f3..d3403aef 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Instalando…"</string> <string name="install_done">"Aplicación instalada"</string> <string name="install_confirm_question">"¿Quieres instalar esta aplicación?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"La aplicación no se instaló correctamente."</string> <string name="launch">"Abierta"</string> <string name="unknown_apps_dlg_title">"Instalación bloqueada"</string> <string name="unknown_apps_dlg_text">"Por motivos de seguridad, tu teléfono se ha configurado para bloquear la instalación de aplicaciones que no pertenecen a Android Market."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Administrar aplicaciones"</string> <string name="dlg_app_replacement_title">"Sustituir aplicación"</string> <string name="dlg_app_replacement_statement">"La aplicación que quieres instalar sustituirá a otra aplicación."\n\n"Se guardarán todos los datos de usuarios anteriores."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Sin espacio"</string> <string name="out_of_space_dlg_text">"No se ha podido ver el archivo <xliff:g id="APP_NAME">%1$s</xliff:g>. Libera espacio en el teléfono e inténtalo de nuevo."</string> <string name="dlg_ok">"Aceptar"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Esta aplicación se eliminará de tu teléfono."</string> <string name="uninstalling">"Desinstalando..."</string> <string name="uninstall_done">"Desinstalación completada"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"No se ha podido desinstalar la aplicación."</string> <string name="Parse_error_dlg_title">"Error de análisis"</string> <string name="Parse_error_dlg_text">"Se ha producido un problema al analizar el paquete."</string> </resources> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 6ee69806..f79724be 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Installation..."</string> <string name="install_done">"Application installée"</string> <string name="install_confirm_question">"Voulez-vous installer cette application ?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Échec de l\'installation de l\'application"</string> <string name="launch">"Ouvrir"</string> <string name="unknown_apps_dlg_title">"Installation bloquée"</string> <string name="unknown_apps_dlg_text">"Pour plus de sécurité, votre téléphone est configuré de sorte à bloquer l\'installation des applications ne provenant pas d\'Android Market."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Gérer les applications"</string> <string name="dlg_app_replacement_title">"Remplacer l\'application"</string> <string name="dlg_app_replacement_statement">"L\'application que vous installez actuellement remplacera l\'autre application."\n\n"Toutes les données d\'utilisateur existantes seront enregistrées."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Mémoire insuffisante"</string> <string name="out_of_space_dlg_text">"Impossible d\'afficher <xliff:g id="APP_NAME">%1$s</xliff:g>. Libérez de l\'espace sur votre téléphone, puis réessayez."</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Cette application va être supprimée de votre téléphone."</string> <string name="uninstalling">"Désinstallation..."</string> <string name="uninstall_done">"Désinstallation terminée !"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Échec de la désinstallation de l\'application"</string> <string name="Parse_error_dlg_title">"Erreur d\'analyse"</string> <string name="Parse_error_dlg_text">"Un problème est survenu lors de l\'analyse du kit."</string> </resources> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index cb45126b..033ce34f 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Installazione..."</string> <string name="install_done">"Applicazione installata"</string> <string name="install_confirm_question">"Installare questa applicazione?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Installazione applicazione non riuscita"</string> <string name="launch">"Apri"</string> <string name="unknown_apps_dlg_title">"Installazione bloccata"</string> <string name="unknown_apps_dlg_text">"Per motivi di sicurezza, il telefono è impostato per bloccare l\'installazione di applicazioni non provenienti da Android Market."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Gestisci applicazioni"</string> <string name="dlg_app_replacement_title">"Sostituisci applicazione"</string> <string name="dlg_app_replacement_statement">"L\'applicazione da installare sostituirà un\'altra applicazione."\n\n"Tutti i dati utente precedenti verranno salvati."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Spazio esaurito"</string> <string name="out_of_space_dlg_text">"Impossibile visualizzare <xliff:g id="APP_NAME">%1$s</xliff:g>. Libera spazio sul telefono e riprova."</string> <string name="dlg_ok">"OK"</string> @@ -46,11 +41,8 @@ <string name="uninstall_application_question">"Disinstallare l\'applicazione?"</string> <string name="uninstall_application_text">"L\'applicazione verrà rimossa dal telefono."</string> <string name="uninstalling">"Disinstallazione..."</string> - <string name="uninstall_done">"Disinstallazione completata"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_done">"Disinstallazione completa."</string> + <string name="uninstall_failed">"Disinstallazione dell\'applicazione non riuscita"</string> <string name="Parse_error_dlg_title">"Errore di analisi"</string> <string name="Parse_error_dlg_text">"Errore durante l\'analisi del pacchetto."</string> </resources> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index e27153d6..1d4d6323 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"インストール中..."</string> <string name="install_done">"アプリケーションをインストールしました"</string> <string name="install_confirm_question">"このアプリケーションをインストールしますか?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"アプリケーションをインストールできませんでした"</string> <string name="launch">"開く"</string> <string name="unknown_apps_dlg_title">"インストールはブロックされました"</string> <string name="unknown_apps_dlg_text">"セキュリティ保護のため、お使いの端末はAndroid Market以外から提供されたアプリケーションのインストールをブロックするよう設定されています。"</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"アプリケーションを管理"</string> <string name="dlg_app_replacement_title">"アプリケーションを更新"</string> <string name="dlg_app_replacement_statement">"このアプリケーションをインストールすると別のアプリケーションが上書きされます。"\n\n"過去のユーザーデータはすべて保存されます。"</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"容量不足です"</string> <string name="out_of_space_dlg_text">"<xliff:g id="APP_NAME">%1$s</xliff:g>を表示できませんでした。端末の空き領域を増やしてもう一度試してください。"</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"このアプリケーションはお使いの端末から削除されます。"</string> <string name="uninstalling">"アンインストール中..."</string> <string name="uninstall_done">"アンインストールが完了しました。"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"アプリケーションをアンインストールできませんでした"</string> <string name="Parse_error_dlg_title">"解析エラー"</string> <string name="Parse_error_dlg_text">"パッケージの解析中に問題が発生しました。"</string> </resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index b9a1738b..2c151e8f 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"설치 중..."</string> <string name="install_done">"응용프로그램이 설치되었습니다."</string> <string name="install_confirm_question">"이 응용프로그램을 설치하시겠습니까?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"응용프로그램 설치에 실패했습니다."</string> <string name="launch">"열기"</string> <string name="unknown_apps_dlg_title">"설치가 차단됨"</string> <string name="unknown_apps_dlg_text">"보안을 위해 전화기가 Android Market에서 제공하지 않은 응용프로그램의 설치를 차단하도록 설정되어 있습니다."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"응용프로그램 관리"</string> <string name="dlg_app_replacement_title">"응용프로그램 교체"</string> <string name="dlg_app_replacement_statement">"설치 중인 응용프로그램이 다른 응용프로그램을 대체합니다."\n\n"이전의 모든 사용자 데이터는 저장됩니다.\n."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"여유 공간이 없음"</string> <string name="out_of_space_dlg_text">"<xliff:g id="APP_NAME">%1$s</xliff:g>을(를) 볼 수 없습니다. 전화기에서 여유 공간을 늘린 후에 다시 시도하세요."</string> <string name="dlg_ok">"확인"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"전화기에서 이 응용프로그램이 삭제됩니다."</string> <string name="uninstalling">"제거 중..."</string> <string name="uninstall_done">"제거가 완료되었습니다."</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"응용프로그램 제거에 실패했습니다."</string> <string name="Parse_error_dlg_title">"구문 분석 오류"</string> <string name="Parse_error_dlg_text">"패키지를 구문 분석하는 중 문제가 발생했습니다."</string> </resources> diff --git a/res/values-nb/strings.xml b/res/values-nb/strings.xml index 06d95930..d00f8f2d 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -25,8 +25,6 @@ <string name="install_done">"Applikasjon installert"</string> <string name="install_confirm_question">"Ønsker du å installere denne applikasjonen?"</string> <string name="install_failed">"Installasjon vellykket"</string> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> <string name="launch">"Åpne"</string> <string name="unknown_apps_dlg_title">"Installasjonen ble blokkert"</string> <string name="unknown_apps_dlg_text">"Av sikkerhetsgrunner er telefonen satt til å blokkere installasjon av applikasjoner som ikke kommer fra Android-markedet."</string> @@ -35,8 +33,6 @@ <string name="manage_applications">"Administrer applikasjoner"</string> <string name="dlg_app_replacement_title">"Erstatt applikasjon"</string> <string name="dlg_app_replacement_statement">"Applikasjonen du installerer vil erstatte en annen applikasjon."\n\n"Alle eksisterende brukerdata vil bli lagret."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Tom for plass"</string> <string name="out_of_space_dlg_text">"Kunne ikke vise <xliff:g id="APP_NAME">%1$s</xliff:g>. Frigjør plass på telefonen og prøv igjen."</string> <string name="dlg_ok">"OK"</string> @@ -47,8 +43,6 @@ <string name="uninstalling">"Avinstallerer…"</string> <string name="uninstall_done">"Avintallasjon fullført!"</string> <string name="uninstall_failed">"Avinstallasjonen var mislykket"</string> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> <string name="Parse_error_dlg_title">"Parsefeil"</string> <string name="Parse_error_dlg_text">"Det oppsto et problem under tolkningen av pakken."</string> </resources> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 3835272a..ece9b880 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Installeren..."</string> <string name="install_done">"Toepassing is geïnstalleerd"</string> <string name="install_confirm_question">"Wilt u deze toepassing installeren?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Installatie van toepassing is mislukt"</string> <string name="launch">"Openen"</string> <string name="unknown_apps_dlg_title">"De installatie is geblokkeerd"</string> <string name="unknown_apps_dlg_text">"Voor de veiligheid is uw telefoon ingesteld op het blokkeren van de installatie van toepassingen die niet in Android Market zijn opgenomen."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Toepassingen beheren"</string> <string name="dlg_app_replacement_title">"Toepassing vervangen"</string> <string name="dlg_app_replacement_statement">"De toepassing die u installeert, vervangt een andere toepassing."\n\n"Alle bestaande gebruikersgegevens worden opgeslagen."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Geen ruimte beschikbaar"</string> <string name="out_of_space_dlg_text">"<xliff:g id="APP_NAME">%1$s</xliff:g> kan niet worden weergegeven. Maak ruimte vrij op uw telefoon en probeer het opnieuw."</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Deze toepassing wordt verwijderd van uw telefoon."</string> <string name="uninstalling">"Verwijderen..."</string> <string name="uninstall_done">"Verwijdering voltooid."</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Verwijderen van toepassing is mislukt"</string> <string name="Parse_error_dlg_title">"Parseerfout"</string> <string name="Parse_error_dlg_text">"Er is een probleem opgetreden bij het parseren van het pakket."</string> </resources> diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 2cb3d305..6f8d7bc1 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Instalowanie..."</string> <string name="install_done">"Aplikacja została zainstalowana"</string> <string name="install_confirm_question">"Czy zainstalować tę aplikację?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Instalacja aplikacji nie powiodła się"</string> <string name="launch">"Otwórz"</string> <string name="unknown_apps_dlg_title">"Instalowanie zablokowane"</string> <string name="unknown_apps_dlg_text">"Ze względów bezpieczeństwa telefon jest ustawiony tak, aby blokować instalowanie aplikacji niepochodzących z katalogu Android Market."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Zarządzaj aplikacjami"</string> <string name="dlg_app_replacement_title">"Zastąp aplikację"</string> <string name="dlg_app_replacement_statement">"Instalowana aplikacja zastąpi inną aplikację."\n\n"Wszystkie poprzednie dane użytkownika zostaną zachowane."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Brak miejsca"</string> <string name="out_of_space_dlg_text">"Nie można wyświetlić <xliff:g id="APP_NAME">%1$s</xliff:g>. Zwolnij miejsce w telefonie i spróbuj ponownie."</string> <string name="dlg_ok">"OK"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Ta aplikacja zostanie usunięta z telefonu."</string> <string name="uninstalling">"Deinstalowanie..."</string> <string name="uninstall_done">"Zakończono deinstalowanie."</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Deinstalowanie aplikacji nie powiodło się"</string> <string name="Parse_error_dlg_title">"Błąd parsowania"</string> <string name="Parse_error_dlg_text">"Wystąpił problem podczas parsowania pakietu."</string> </resources> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 89562d15..b075dfbb 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"Установка..."</string> <string name="install_done">"Приложение установлено"</string> <string name="install_confirm_question">"Установить это приложение?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"Не удалось установить приложение."</string> <string name="launch">"Открыть"</string> <string name="unknown_apps_dlg_title">"Установка заблокирована"</string> <string name="unknown_apps_dlg_text">"Из соображений безопасности на вашем телефоне заблокирована установка приложений, источником которых не является Android Маркет."</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"Управлять приложениями"</string> <string name="dlg_app_replacement_title">"Заменить приложение"</string> <string name="dlg_app_replacement_statement">"Приложение, которое вы устанавливаете, заменит другое приложение."\n\n"Все пользовательские данные будут сохранены."</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"Недостаточно места"</string> <string name="out_of_space_dlg_text">"Невозможно просмотреть <xliff:g id="APP_NAME">%1$s</xliff:g>. Освободите место в памяти телефона и повторите попытку."</string> <string name="dlg_ok">"ОК"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"Данное приложение будет удалено с вашего телефона."</string> <string name="uninstalling">"Удаление..."</string> <string name="uninstall_done">"Удаление завершено!"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"Не удалось удалить приложение"</string> <string name="Parse_error_dlg_title">"Синтаксическая ошибка"</string> <string name="Parse_error_dlg_text">"При анализе пакета возникла проблема."</string> </resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 07ea62b3..e7e109ad 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"正在安装..."</string> <string name="install_done">"应用程序已安装"</string> <string name="install_confirm_question">"是否要安装该应用程序?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"应用程序安装失败"</string> <string name="launch">"打开"</string> <string name="unknown_apps_dlg_title">"禁止安装"</string> <string name="unknown_apps_dlg_text">"为了安全起见,您的手机设置为禁止安装不是随 Android Market 提供的应用程序。"</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"管理应用程序"</string> <string name="dlg_app_replacement_title">"替换应用程序"</string> <string name="dlg_app_replacement_statement">"您正在安装的应用程序会替换其他应用程序。"\n\n"会保存所有以前的用户数据。"</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"空间不足"</string> <string name="out_of_space_dlg_text">"无法查看<xliff:g id="APP_NAME">%1$s</xliff:g>。请释放部分手机空间,然后重试。"</string> <string name="dlg_ok">"确定"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"该应用程序会从您的手机中删除。"</string> <string name="uninstalling">"正在卸载..."</string> <string name="uninstall_done">"卸载完成!"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"应用程序卸载失败"</string> <string name="Parse_error_dlg_title">"解析错误"</string> <string name="Parse_error_dlg_text">"解析包时出现问题。"</string> </resources> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 97a2b047..78e3c7ff 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -24,10 +24,7 @@ <string name="installing">"安裝中..."</string> <string name="install_done">"已安裝的應用程式"</string> <string name="install_confirm_question">"要安裝此應用程式嗎?"</string> - <!-- no translation found for install_failed (6644311739017660989) --> - <skip /> - <!-- no translation found for install_failed_msg (5282789300118241924) --> - <skip /> + <string name="install_failed">"應用程式安裝失敗"</string> <string name="launch">"開啟"</string> <string name="unknown_apps_dlg_title">"安裝遭封鎖。"</string> <string name="unknown_apps_dlg_text">"為維護安全,您的手機設定不會安裝非 Android Market 所提供的應用程式。"</string> @@ -36,8 +33,6 @@ <string name="manage_applications">"管理應用程式"</string> <string name="dlg_app_replacement_title">"取代應用程式"</string> <string name="dlg_app_replacement_statement">"您所要安裝的應用程式將會取代其他的應用程式。"\n\n"將會儲存所有先前的使用者資料。"</string> - <!-- no translation found for dlg_sys_app_replacement_statement (8158736217122431465) --> - <skip /> <string name="out_of_space_dlg_title">"空間不足"</string> <string name="out_of_space_dlg_text">"無法檢視 <xliff:g id="APP_NAME">%1$s</xliff:g>。請先釋放手機上的部分空間,然後再試一次。"</string> <string name="dlg_ok">"確定"</string> @@ -47,10 +42,7 @@ <string name="uninstall_application_text">"此應用程式將從您的手機中移除。"</string> <string name="uninstalling">"解除安裝中..."</string> <string name="uninstall_done">"解除安裝完成!"</string> - <!-- no translation found for uninstall_failed (5725854598594371845) --> - <skip /> - <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> - <skip /> + <string name="uninstall_failed">"應用程式解除安裝失敗"</string> <string name="Parse_error_dlg_title">"剖析錯誤"</string> <string name="Parse_error_dlg_text">"剖析程式時發生問題。"</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index f36660bc..ae155772 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -25,8 +25,7 @@ <string name="installing">Installing\u2026</string> <string name="install_done">Application installed</string> <string name="install_confirm_question">Do you want to install this application?</string> - <string name="install_failed">Application not installed</string> - <string name="install_failed_msg"><xliff:g id="app_name">%1$s</xliff:g> could not be installed on this phone.</string> + <string name="install_failed">Application install unsuccessful</string> <string name="launch">Open</string> <string name="unknown_apps_dlg_title">Install blocked</string> <string name="unknown_apps_dlg_text">For security, your phone is set to block installation of applications not sourced in Android Market.</string> @@ -35,8 +34,6 @@ <string name="manage_applications">Manage applications</string> <string name="dlg_app_replacement_title">Replace application</string> <string name="dlg_app_replacement_statement">The application you are installing will replace another application.\n\nAll previous user data will be saved.</string> - <!-- Dialog attributes when replacing system app --> - <string name="dlg_sys_app_replacement_statement">This is a system application. Do you still want to replace it?\n\nAll previous user data will be saved.</string> <string name="out_of_space_dlg_title">Out of space</string> <string name="out_of_space_dlg_text"><xliff:g id="app_name">%1$s</xliff:g> could not be viewed. Free up some space on your phone and try again.</string> <!-- strings related to uninstall activity --> @@ -48,8 +45,7 @@ found in the list of installed applications.</string> <string name="uninstall_application_text">This application will be removed from your phone.</string> <string name="uninstalling">Uninstalling\u2026</string> <string name="uninstall_done">Uninstall finished!</string> - <string name="uninstall_failed">Uninstall not successful</string> - <string name="uninstall_failed_msg"><xliff:g id="app_name">%1$s</xliff:g> could not be uninstalled!</string> + <string name="uninstall_failed">Application uninstall not successful</string> <!-- Dialog attributes to indicate parse errors --> <string name="Parse_error_dlg_title">Parse Error</string> diff --git a/src/com/android/packageinstaller/InstallAppDone.java b/src/com/android/packageinstaller/InstallAppDone.java index 5a3f7d65..554ed2db 100755 --- a/src/com/android/packageinstaller/InstallAppDone.java +++ b/src/com/android/packageinstaller/InstallAppDone.java @@ -20,7 +20,6 @@ import com.android.packageinstaller.R; import android.app.Activity; import android.content.Intent; import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; @@ -73,11 +72,8 @@ public class InstallAppDone extends Activity implements View.OnClickListener { centerTextDrawableId = R.drawable.button_indicator_finish; centerTextLabel = R.string.install_done; // Enable or disable launch button - try { - mLaunchIntent = getPackageManager().getLaunchIntentForPackage( - mAppInfo.packageName); - } catch (PackageManager.NameNotFoundException e) { - } + mLaunchIntent = PackageUtil.getLaunchIntentForPackage(this, + mAppInfo.packageName); if(mLaunchIntent != null) { mLaunchButton.setOnClickListener(this); } else { diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java index 29f05b43..deeb8f42 100644 --- a/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -24,7 +24,6 @@ import java.io.FileOutputStream; import java.io.IOException; import android.app.Activity; import android.app.AlertDialog; -import android.app.Dialog; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -32,11 +31,9 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.DialogInterface.OnCancelListener; -import android.content.pm.ApplicationInfo; import android.content.pm.IPackageDataObserver; import android.content.pm.PackageManager; import android.content.pm.PackageParser; -import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.os.Bundle; import android.os.FileUtils; @@ -57,10 +54,10 @@ import android.view.Window; * sub activity. All state transitions are handled in this activity */ public class PackageInstallerActivity extends Activity implements OnCancelListener { - private static final int INSTALL_INITIAL = 0; - private static final int INSTALL_CONFIRM = 1; - private static final int INSTALL_PROGRESS = 2; - private static final int INSTALL_DONE = 3; + private static final int INSTALL_INITIAL=0; + private static final int INSTALL_CONFIRM=1; + private static final int INSTALL_PROGRESS=2; + private static final int INSTALL_DONE=3; private static final String TAG = "PackageInstaller"; private Uri mPackageURI; private boolean localLOGV = false; @@ -68,24 +65,13 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen PackageManager mPm; private PackageParser.Package mPkgInfo; private File mTmpFile; - private static final int SUCCEEDED = 1; - private static final int FAILED = 0; + private Uri mPackageUri; + private static final int SUCCEEDED=1; + private static final int FAILED=0; // Broadcast receiver for clearing cache ClearCacheReceiver mClearCacheReceiver; private static final int HANDLER_BASE_MSG_IDX = 0; - private static final int FREE_SPACE = HANDLER_BASE_MSG_IDX + 1; - - // ApplicationInfo object primarily used for already existing applications - private ApplicationInfo mAppInfo = null; - - // Dialog identifiers used in showDialog - private static final int DLG_BASE = 0; - private static final int DLG_REPLACE_APP = DLG_BASE + 1; - private static final int DLG_UNKNOWN_APPS = DLG_BASE + 2; - private static final int DLG_PACKAGE_ERROR = DLG_BASE + 3; - private static final int DLG_OUT_OF_SPACE = DLG_BASE + 4; - private static final int DLG_INSTALL_ERROR = DLG_BASE + 5; - + private static final int FREE_SPACE = HANDLER_BASE_MSG_IDX+1; private Handler mHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { @@ -94,7 +80,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if(msg.arg1 == SUCCEEDED) { makeTempCopyAndInstall(); } else { - showDialogInner(DLG_OUT_OF_SPACE); + displayOutOfSpaceDialog(); } break; default: @@ -107,7 +93,6 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen Intent newIntent = new Intent(); startInstallActivityClass(newIntent, requestCode, cls); } - private void startInstallActivityClass(Intent newIntent, int requestCode, Class<?> cls) { newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, mPkgInfo.applicationInfo); @@ -116,7 +101,8 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if(localLOGV) Log.i(TAG, "downloaded app uri="+mPackageURI); startActivityForResult(newIntent, requestCode); } - + + private void startInstallConfirm() { Intent newIntent = new Intent(); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, @@ -130,112 +116,107 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen startInstallActivityClass(INSTALL_PROGRESS, InstallAppProgress.class); } - private void startInstallDone() { + private void startInstallDone(boolean result) { Intent newIntent = new Intent(Intent.ACTION_VIEW); - newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, true); + newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, result); startInstallActivityClass(newIntent, INSTALL_DONE, InstallAppDone.class); } - private void showDialogInner(int id) { - // TODO better fix for this? Remove dialog so that it gets created again - removeDialog(id); - showDialog(id); + private void displayReplaceAppDialog() { + new AlertDialog.Builder(this) + .setTitle(R.string.dlg_app_replacement_title) + .setMessage(R.string.dlg_app_replacement_statement) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + startInstallConfirm(); + }}) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Log.i(TAG, "Canceling installation"); + finish(); + }}) + .setOnCancelListener(this) + .show(); + } + + + /* + * Utility method to display a dialog prompting the user to turn on settings property + * before installing application + */ + private void displayUnknowAppsDialog() { + new AlertDialog.Builder(this) + .setTitle(R.string.unknown_apps_dlg_title) + .setMessage(R.string.unknown_apps_dlg_text) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Log.i(TAG, "Finishing off activity so that user can navigate to settings manually"); + finish(); + }}) + .setPositiveButton(R.string.settings, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Log.i(TAG, "Launching settings"); + launchSettingsAppAndFinish(); + } + }) + .setOnCancelListener(this) + .show(); + } + + /* + * Utility method to display a dialog indicating a parse error when parsing the package + */ + private void displayPackageErrorDialog() { + new AlertDialog.Builder(this) + .setTitle(R.string.Parse_error_dlg_title) + .setMessage(R.string.Parse_error_dlg_text) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + finish(); + } + }) + .setOnCancelListener(this) + .show(); + } + + /* + * Utility method to display dialog indicating out of disk space + */ + private void displayOutOfSpaceDialog() { + //guaranteed not to be null. will default to package name if not set by app + CharSequence appTitle = mPm.getApplicationLabel(mPkgInfo.applicationInfo); + String dlgText = getString(R.string.out_of_space_dlg_text, + appTitle.toString()); + + new AlertDialog.Builder(this) + .setTitle(R.string.out_of_space_dlg_title) + .setMessage(dlgText) + .setPositiveButton(R.string.manage_applications, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //launch manage applications + Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE"); + startActivity(intent); + finish(); + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + Log.i(TAG, "Canceling installation"); + finish(); + } + }) + .setOnCancelListener(this) + .show(); } - @Override - public Dialog onCreateDialog(int id) { - switch (id) { - case DLG_REPLACE_APP: - int msgId = R.string.dlg_app_replacement_statement; - // Customized text for system apps - if ((mAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { - msgId = R.string.dlg_sys_app_replacement_statement; - } - return new AlertDialog.Builder(this) - .setTitle(R.string.dlg_app_replacement_title) - .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - startInstallConfirm(); - }}) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - Log.i(TAG, "Canceling installation"); - finish(); - }}) - .setMessage(msgId) - .setOnCancelListener(this) - .create(); - case DLG_UNKNOWN_APPS: - return new AlertDialog.Builder(this) - .setTitle(R.string.unknown_apps_dlg_title) - .setMessage(R.string.unknown_apps_dlg_text) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - Log.i(TAG, "Finishing off activity so that user can navigate to settings manually"); - finish(); - }}) - .setPositiveButton(R.string.settings, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - Log.i(TAG, "Launching settings"); - launchSettingsAppAndFinish(); - } - }) - .setOnCancelListener(this) - .create(); - case DLG_PACKAGE_ERROR : - return new AlertDialog.Builder(this) - .setTitle(R.string.Parse_error_dlg_title) - .setMessage(R.string.Parse_error_dlg_text) - .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - finish(); - } - }) - .setOnCancelListener(this) - .create(); - case DLG_OUT_OF_SPACE: - // Guaranteed not to be null. will default to package name if not set by app - CharSequence appTitle = mPm.getApplicationLabel(mPkgInfo.applicationInfo); - String dlgText = getString(R.string.out_of_space_dlg_text, - appTitle.toString()); - return new AlertDialog.Builder(this) - .setTitle(R.string.out_of_space_dlg_title) - .setMessage(dlgText) - .setPositiveButton(R.string.manage_applications, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - //launch manage applications - Intent intent = new Intent("android.intent.action.MANAGE_PACKAGE_STORAGE"); - startActivity(intent); - finish(); - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - Log.i(TAG, "Canceling installation"); - finish(); - } - }) - .setOnCancelListener(this) - .create(); - case DLG_INSTALL_ERROR : - // Guaranteed not to be null. will default to package name if not set by app - CharSequence appTitle1 = mPm.getApplicationLabel(mPkgInfo.applicationInfo); - String dlgText1 = getString(R.string.install_failed_msg, - appTitle1.toString()); - return new AlertDialog.Builder(this) - .setTitle(R.string.install_failed) - .setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - finish(); - } - }) - .setMessage(dlgText1) - .setOnCancelListener(this) - .create(); - } - return null; - } - + private class PkgDataObserver extends IPackageDataObserver.Stub { + public void onRemoveCompleted(String packageName, boolean succeeded) { + Message msg = mHandler.obtainMessage(FREE_SPACE); + msg.arg1 = succeeded?SUCCEEDED:FAILED; + mHandler.sendMessage(msg); + } + } + private class ClearCacheReceiver extends BroadcastReceiver { public static final String INTENT_CLEAR_CACHE = "com.android.packageinstaller.CLEAR_CACHE"; @@ -307,23 +288,19 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if(mTmpFile == null) { //display a dialog Log.e(TAG, "Error copying file locally. Failed Installation"); - showDialogInner(DLG_OUT_OF_SPACE); + displayOutOfSpaceDialog(); return; } mPackageURI = Uri.parse("file://"+mTmpFile.getPath()); // Check if package is already installed. display confirmation dialog if replacing pkg - try { - mAppInfo = mPm.getApplicationInfo(mPkgInfo.packageName, - PackageManager.GET_UNINSTALLED_PACKAGES); - } catch (NameNotFoundException e) { - mAppInfo = null; - } - if (mAppInfo == null) { - startInstallConfirm(); - } else { + boolean alreadyInstalled = PackageUtil.isPackageAlreadyInstalled(this, + mPkgInfo.applicationInfo.packageName); + if(alreadyInstalled) { if(localLOGV) Log.i(TAG, "Replacing existing package:"+ mPkgInfo.applicationInfo.packageName); - showDialogInner(DLG_REPLACE_APP); + displayReplaceAppDialog(); + } else { + startInstallConfirm(); } } @@ -333,16 +310,14 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen //get intent information final Intent intent = getIntent(); mPackageURI = intent.getData(); - mPm = getPackageManager(); mPkgInfo = PackageUtil.getPackageInfo(mPackageURI); - // Check for parse errors if(mPkgInfo == null) { Log.w(TAG, "Parse error when parsing manifest. Discontinuing installation"); - showDialogInner(DLG_PACKAGE_ERROR); + displayPackageErrorDialog(); return; } - + mPm = getPackageManager(); //set view requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.install_start); @@ -350,7 +325,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen //check setting if(!isInstallingUnknownAppsAllowed()) { //ask user to enable setting first - showDialogInner(DLG_UNKNOWN_APPS); + displayUnknowAppsDialog(); return; } //compute the size of the application. just an estimate @@ -386,16 +361,16 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen } break; case INSTALL_PROGRESS: + boolean ok = false; finish = false; mCurrentState = INSTALL_DONE; if (resultCode == PackageManager.INSTALL_SUCCEEDED) { - //start the next screen to show final status of installation - startInstallDone(); - } else { - showDialogInner(DLG_INSTALL_ERROR); + ok = true; } // Now that the package is installed just delete the temp file removeTmpFile = true; + //start the next screen to show final status of installation + startInstallDone(ok); break; case INSTALL_DONE: //neednt check for result code here diff --git a/src/com/android/packageinstaller/PackageUtil.java b/src/com/android/packageinstaller/PackageUtil.java index b36bcf2b..6dc782de 100644 --- a/src/com/android/packageinstaller/PackageUtil.java +++ b/src/com/android/packageinstaller/PackageUtil.java @@ -118,4 +118,29 @@ public class PackageUtil { } return false; } + + /** + * Returns an intent that can be used to launch the main activity in the given package. + * + * @param ctx + * @param packageName + * @return an intent launching the main activity in the given package + */ + public static Intent getLaunchIntentForPackage(Context ctx, String packageName) { + Intent intent = new Intent(Intent.ACTION_MAIN); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + PackageManager manager = ctx.getPackageManager(); + Intent intentToResolve = new Intent(Intent.ACTION_MAIN, null); + intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER); + final List<ResolveInfo> apps = + manager.queryIntentActivities(intentToResolve, 0); + // TODO in future add a new tag to application for launchable main activity + for (ResolveInfo app : apps) { + if (app.activityInfo.packageName.equals(packageName)) { + intent.setClassName(packageName, app.activityInfo.name); + return intent; + } + } + return null; + } } diff --git a/src/com/android/packageinstaller/UninstallerActivity.java b/src/com/android/packageinstaller/UninstallerActivity.java index f22cc28a..b80f8ef1 100755 --- a/src/com/android/packageinstaller/UninstallerActivity.java +++ b/src/com/android/packageinstaller/UninstallerActivity.java @@ -19,7 +19,6 @@ package com.android.packageinstaller; import com.android.packageinstaller.R; import android.app.Activity; import android.app.AlertDialog; -import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -41,59 +40,16 @@ import android.content.pm.PackageManager.NameNotFoundException; public class UninstallerActivity extends Activity implements OnClickListener { private static final String TAG = "UninstallerActivity"; private boolean localLOGV = false; - // States indicating status of ui display when uninstalling application - private static final int UNINSTALL_CONFIRM = 1; - private static final int UNINSTALL_PROGRESS = 2; - private static final int UNINSTALL_DONE = 3; + //states indicating status of ui display when uninstalling application + private static final int UNINSTALL_CONFIRM=1; + private static final int UNINSTALL_PROGRESS=2; + private static final int UNINSTALL_DONE=3; private int mCurrentState = UNINSTALL_CONFIRM; PackageManager mPm; private ApplicationInfo mAppInfo; private Button mOk; private Button mCancel; - - // Dialog identifiers used in showDialog - private static final int DLG_BASE = 0; - private static final int DLG_APP_NOT_FOUND = DLG_BASE + 1; - private static final int DLG_UNINSTALL_FAILED = DLG_BASE + 2; - - private void showDialogInner(int id) { - showDialog(id); - } - @Override - public Dialog onCreateDialog(int id) { - switch (id) { - case DLG_APP_NOT_FOUND : - return new AlertDialog.Builder(this) - .setTitle(R.string.app_not_found_dlg_title) - .setIcon(com.android.internal.R.drawable.ic_dialog_alert) - .setMessage(R.string.app_not_found_dlg_text) - .setNeutralButton(getString(R.string.dlg_ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - finish(); - }}) - .create(); - case DLG_UNINSTALL_FAILED : - // Guaranteed not to be null. will default to package name if not set by app - CharSequence appTitle = mPm.getApplicationLabel(mAppInfo); - String dlgText = getString(R.string.uninstall_failed_msg, - appTitle.toString()); - // Display uninstall failed dialog - return new AlertDialog.Builder(this) - .setTitle(R.string.uninstall_failed) - .setIcon(com.android.internal.R.drawable.ic_dialog_alert) - .setMessage(dlgText) - .setNeutralButton(getString(R.string.dlg_ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - finish(); - }}) - .create(); - } - return null; - } - private void startUninstallProgress() { Intent newIntent = new Intent(Intent.ACTION_VIEW); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, @@ -102,15 +58,32 @@ public class UninstallerActivity extends Activity implements OnClickListener { startActivityForResult(newIntent, UNINSTALL_PROGRESS); } - private void startUninstallDone() { + private void startUninstallDone(boolean result) { Intent newIntent = new Intent(Intent.ACTION_VIEW); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, mAppInfo); - newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, true); + newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, result); newIntent.setClass(this, UninstallAppDone.class); startActivityForResult(newIntent, UNINSTALL_DONE); } - + + private void displayErrorDialog(int msgId) { + //display confirmation dialog + new AlertDialog.Builder(this) + .setTitle(getString(R.string.app_not_found_dlg_title)) + .setIcon(com.android.internal.R.drawable.ic_dialog_alert) + .setMessage(getString(msgId)) + .setNeutralButton(getString(R.string.dlg_ok), + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //force to recompute changed value + finish(); + } + } + ) + .show(); + } + @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); @@ -120,7 +93,7 @@ public class UninstallerActivity extends Activity implements OnClickListener { String packageName = packageURI.getEncodedSchemeSpecificPart(); if(packageName == null) { Log.e(TAG, "Invalid package name:"+packageName); - showDialog(DLG_APP_NOT_FOUND); + displayErrorDialog(R.string.app_not_found_dlg_text); return; } //initialize package manager @@ -133,7 +106,7 @@ public class UninstallerActivity extends Activity implements OnClickListener { } if(mAppInfo == null || errFlag) { Log.e(TAG, "Invalid application:"+packageName); - showDialog(DLG_APP_NOT_FOUND); + displayErrorDialog(R.string.app_not_found_dlg_text); } else { requestWindowFeature(Window.FEATURE_NO_TITLE); //set view @@ -155,11 +128,7 @@ public class UninstallerActivity extends Activity implements OnClickListener { finish = false; mCurrentState = UNINSTALL_DONE; //start the next screen to show final status of installation - if (resultCode==UninstallAppProgress.SUCCEEDED) { - startUninstallDone(); - } else { - showDialogInner(DLG_UNINSTALL_FAILED); - } + startUninstallDone(resultCode==UninstallAppProgress.SUCCEEDED); break; case UNINSTALL_DONE: //neednt check for result code here |