diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:43 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-02 22:54:43 -0800 |
commit | 2fa4ad8141ed0cb686c7acab27f01e8c2bc2877a (patch) | |
tree | 59fc988de9bdfbca4bcf0b946d29bceda657fa7c | |
parent | 9162d55f6dd35c1c4e76a27876435d17c0a5d14b (diff) | |
download | packages_apps_packageinstaller-2fa4ad8141ed0cb686c7acab27f01e8c2bc2877a.zip packages_apps_packageinstaller-2fa4ad8141ed0cb686c7acab27f01e8c2bc2877a.tar.gz packages_apps_packageinstaller-2fa4ad8141ed0cb686c7acab27f01e8c2bc2877a.tar.bz2 |
auto import from //depot/cupcake/@137055
-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, 400 insertions, 256 deletions
diff --git a/res/layout/install_confirm.xml b/res/layout/install_confirm.xml index bc4fde2..bfda97d 100755 --- a/res/layout/install_confirm.xml +++ b/res/layout/install_confirm.xml @@ -21,46 +21,43 @@ user before it is installed. --> -<ScrollView +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="vertical" android:layout_width="fill_parent" - android:layout_height="fill_parent" - android:fillViewport="true" - android:background="@color/view_background"> + android:layout_height="fill_parent"> - <LinearLayout - android:id="@+id/all_details" - android:layout_width="fill_parent" - 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:text="@string/install_confirm_question" + android:textAppearance="?android:attr/textAppearanceMedium" + android:paddingTop="20dip" + android:paddingLeft="20dip" + android:paddingBottom="20dip"/> - <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"/> + <ScrollView + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:fillViewport="true" + android:layout_weight="1"> <!-- 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"/> @@ -72,37 +69,40 @@ 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" + <!-- 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" 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> + 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> -</ScrollView> +</LinearLayout> diff --git a/res/layout/uninstall_confirm.xml b/res/layout/uninstall_confirm.xml index 62bd154..3f7f18a 100755 --- a/res/layout/uninstall_confirm.xml +++ b/res/layout/uninstall_confirm.xml @@ -63,6 +63,9 @@ 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 c76ddff..76247bb 100644 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Instalace..."</string> <string name="install_done">"Aplikace byla nainstalována"</string> <string name="install_confirm_question">"Chcete tuto aplikaci nainstalovat?"</string> - <string name="install_failed">"Instalace aplikace se nezdařila"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"Odinstalace aplikace se nezdařila."</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 1e5607e..85eb053 100644 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Installation..."</string> <string name="install_done">"Anwendung installiert"</string> <string name="install_confirm_question">"Möchten Sie diese Anwendung installieren?"</string> - <string name="install_failed">"Installation der Anwendung nicht erfolgreich"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"Deinstallierung der Anwendung fehlgeschlagen"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 d3403ae..a75f36f 100644 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Instalando…"</string> <string name="install_done">"Aplicación instalada"</string> <string name="install_confirm_question">"¿Quieres instalar esta aplicación?"</string> - <string name="install_failed">"La aplicación no se instaló correctamente."</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"No se ha podido desinstalar la aplicación."</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 f79724b..6ee6980 100644 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Installation..."</string> <string name="install_done">"Application installée"</string> <string name="install_confirm_question">"Voulez-vous installer cette application ?"</string> - <string name="install_failed">"Échec de l\'installation de l\'application"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"Échec de la désinstallation de l\'application"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 033ce34..cb45126 100644 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Installazione..."</string> <string name="install_done">"Applicazione installata"</string> <string name="install_confirm_question">"Installare questa applicazione?"</string> - <string name="install_failed">"Installazione applicazione non riuscita"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -41,8 +46,11 @@ <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 completa."</string> - <string name="uninstall_failed">"Disinstallazione dell\'applicazione non riuscita"</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="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 1d4d632..e27153d 100644 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"インストール中..."</string> <string name="install_done">"アプリケーションをインストールしました"</string> <string name="install_confirm_question">"このアプリケーションをインストールしますか?"</string> - <string name="install_failed">"アプリケーションをインストールできませんでした"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <string name="launch">"開く"</string> <string name="unknown_apps_dlg_title">"インストールはブロックされました"</string> <string name="unknown_apps_dlg_text">"セキュリティ保護のため、お使いの端末はAndroid Market以外から提供されたアプリケーションのインストールをブロックするよう設定されています。"</string> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <string name="uninstall_application_text">"このアプリケーションはお使いの端末から削除されます。"</string> <string name="uninstalling">"アンインストール中..."</string> <string name="uninstall_done">"アンインストールが完了しました。"</string> - <string name="uninstall_failed">"アプリケーションをアンインストールできませんでした"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 2c151e8..b9a1738 100644 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"설치 중..."</string> <string name="install_done">"응용프로그램이 설치되었습니다."</string> <string name="install_confirm_question">"이 응용프로그램을 설치하시겠습니까?"</string> - <string name="install_failed">"응용프로그램 설치에 실패했습니다."</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <string name="launch">"열기"</string> <string name="unknown_apps_dlg_title">"설치가 차단됨"</string> <string name="unknown_apps_dlg_text">"보안을 위해 전화기가 Android Market에서 제공하지 않은 응용프로그램의 설치를 차단하도록 설정되어 있습니다."</string> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <string name="uninstall_application_text">"전화기에서 이 응용프로그램이 삭제됩니다."</string> <string name="uninstalling">"제거 중..."</string> <string name="uninstall_done">"제거가 완료되었습니다."</string> - <string name="uninstall_failed">"응용프로그램 제거에 실패했습니다."</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 d00f8f2..06d9593 100644 --- a/res/values-nb/strings.xml +++ b/res/values-nb/strings.xml @@ -25,6 +25,8 @@ <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> @@ -33,6 +35,8 @@ <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> @@ -43,6 +47,8 @@ <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 ece9b88..3835272 100644 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -24,7 +24,10 @@ <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> - <string name="install_failed">"Installatie van toepassing is mislukt"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"Verwijderen van toepassing is mislukt"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 6f8d7bc..2cb3d30 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Instalowanie..."</string> <string name="install_done">"Aplikacja została zainstalowana"</string> <string name="install_confirm_question">"Czy zainstalować tę aplikację?"</string> - <string name="install_failed">"Instalacja aplikacji nie powiodła się"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <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> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <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> - <string name="uninstall_failed">"Deinstalowanie aplikacji nie powiodło się"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 b075dfb..89562d1 100644 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"Установка..."</string> <string name="install_done">"Приложение установлено"</string> <string name="install_confirm_question">"Установить это приложение?"</string> - <string name="install_failed">"Не удалось установить приложение."</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <string name="launch">"Открыть"</string> <string name="unknown_apps_dlg_title">"Установка заблокирована"</string> <string name="unknown_apps_dlg_text">"Из соображений безопасности на вашем телефоне заблокирована установка приложений, источником которых не является Android Маркет."</string> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <string name="uninstall_application_text">"Данное приложение будет удалено с вашего телефона."</string> <string name="uninstalling">"Удаление..."</string> <string name="uninstall_done">"Удаление завершено!"</string> - <string name="uninstall_failed">"Не удалось удалить приложение"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 e7e109a..07ea62b 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"正在安装..."</string> <string name="install_done">"应用程序已安装"</string> <string name="install_confirm_question">"是否要安装该应用程序?"</string> - <string name="install_failed">"应用程序安装失败"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <string name="launch">"打开"</string> <string name="unknown_apps_dlg_title">"禁止安装"</string> <string name="unknown_apps_dlg_text">"为了安全起见,您的手机设置为禁止安装不是随 Android Market 提供的应用程序。"</string> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <string name="uninstall_application_text">"该应用程序会从您的手机中删除。"</string> <string name="uninstalling">"正在卸载..."</string> <string name="uninstall_done">"卸载完成!"</string> - <string name="uninstall_failed">"应用程序卸载失败"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 78e3c7f..97a2b04 100644 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -24,7 +24,10 @@ <string name="installing">"安裝中..."</string> <string name="install_done">"已安裝的應用程式"</string> <string name="install_confirm_question">"要安裝此應用程式嗎?"</string> - <string name="install_failed">"應用程式安裝失敗"</string> + <!-- no translation found for install_failed (6644311739017660989) --> + <skip /> + <!-- no translation found for install_failed_msg (5282789300118241924) --> + <skip /> <string name="launch">"開啟"</string> <string name="unknown_apps_dlg_title">"安裝遭封鎖。"</string> <string name="unknown_apps_dlg_text">"為維護安全,您的手機設定不會安裝非 Android Market 所提供的應用程式。"</string> @@ -33,6 +36,8 @@ <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> @@ -42,7 +47,10 @@ <string name="uninstall_application_text">"此應用程式將從您的手機中移除。"</string> <string name="uninstalling">"解除安裝中..."</string> <string name="uninstall_done">"解除安裝完成!"</string> - <string name="uninstall_failed">"應用程式解除安裝失敗"</string> + <!-- no translation found for uninstall_failed (5725854598594371845) --> + <skip /> + <!-- no translation found for uninstall_failed_msg (5480019148754200912) --> + <skip /> <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 ae15577..f36660b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -25,7 +25,8 @@ <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 install unsuccessful</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="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> @@ -34,6 +35,8 @@ <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 --> @@ -45,7 +48,8 @@ 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">Application uninstall not successful</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> <!-- 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 554ed2d..5a3f7d6 100755 --- a/src/com/android/packageinstaller/InstallAppDone.java +++ b/src/com/android/packageinstaller/InstallAppDone.java @@ -20,6 +20,7 @@ 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; @@ -72,8 +73,11 @@ public class InstallAppDone extends Activity implements View.OnClickListener { centerTextDrawableId = R.drawable.button_indicator_finish; centerTextLabel = R.string.install_done; // Enable or disable launch button - mLaunchIntent = PackageUtil.getLaunchIntentForPackage(this, - mAppInfo.packageName); + try { + mLaunchIntent = getPackageManager().getLaunchIntentForPackage( + mAppInfo.packageName); + } catch (PackageManager.NameNotFoundException e) { + } if(mLaunchIntent != null) { mLaunchButton.setOnClickListener(this); } else { diff --git a/src/com/android/packageinstaller/PackageInstallerActivity.java b/src/com/android/packageinstaller/PackageInstallerActivity.java index deeb8f4..29f05b4 100644 --- a/src/com/android/packageinstaller/PackageInstallerActivity.java +++ b/src/com/android/packageinstaller/PackageInstallerActivity.java @@ -24,6 +24,7 @@ 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; @@ -31,9 +32,11 @@ 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; @@ -54,10 +57,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; @@ -65,13 +68,24 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen PackageManager mPm; private PackageParser.Package mPkgInfo; private File mTmpFile; - private Uri mPackageUri; - private static final int SUCCEEDED=1; - private static final int FAILED=0; + 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; + 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 Handler mHandler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { @@ -80,7 +94,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if(msg.arg1 == SUCCEEDED) { makeTempCopyAndInstall(); } else { - displayOutOfSpaceDialog(); + showDialogInner(DLG_OUT_OF_SPACE); } break; default: @@ -93,6 +107,7 @@ 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); @@ -101,8 +116,7 @@ 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, @@ -116,107 +130,112 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen startInstallActivityClass(INSTALL_PROGRESS, InstallAppProgress.class); } - private void startInstallDone(boolean result) { + private void startInstallDone() { Intent newIntent = new Intent(Intent.ACTION_VIEW); - newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, result); + newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, true); startInstallActivityClass(newIntent, INSTALL_DONE, InstallAppDone.class); } - 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(); + private void showDialogInner(int id) { + // TODO better fix for this? Remove dialog so that it gets created again + removeDialog(id); + showDialog(id); } - 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); - } - } - + @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 ClearCacheReceiver extends BroadcastReceiver { public static final String INTENT_CLEAR_CACHE = "com.android.packageinstaller.CLEAR_CACHE"; @@ -288,19 +307,23 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen if(mTmpFile == null) { //display a dialog Log.e(TAG, "Error copying file locally. Failed Installation"); - displayOutOfSpaceDialog(); + showDialogInner(DLG_OUT_OF_SPACE); return; } mPackageURI = Uri.parse("file://"+mTmpFile.getPath()); // Check if package is already installed. display confirmation dialog if replacing pkg - boolean alreadyInstalled = PackageUtil.isPackageAlreadyInstalled(this, - mPkgInfo.applicationInfo.packageName); - if(alreadyInstalled) { + try { + mAppInfo = mPm.getApplicationInfo(mPkgInfo.packageName, + PackageManager.GET_UNINSTALLED_PACKAGES); + } catch (NameNotFoundException e) { + mAppInfo = null; + } + if (mAppInfo == null) { + startInstallConfirm(); + } else { if(localLOGV) Log.i(TAG, "Replacing existing package:"+ mPkgInfo.applicationInfo.packageName); - displayReplaceAppDialog(); - } else { - startInstallConfirm(); + showDialogInner(DLG_REPLACE_APP); } } @@ -310,14 +333,16 @@ 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"); - displayPackageErrorDialog(); + showDialogInner(DLG_PACKAGE_ERROR); return; } - mPm = getPackageManager(); + //set view requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.install_start); @@ -325,7 +350,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen //check setting if(!isInstallingUnknownAppsAllowed()) { //ask user to enable setting first - displayUnknowAppsDialog(); + showDialogInner(DLG_UNKNOWN_APPS); return; } //compute the size of the application. just an estimate @@ -361,16 +386,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) { - ok = true; + //start the next screen to show final status of installation + startInstallDone(); + } else { + showDialogInner(DLG_INSTALL_ERROR); } // 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 6dc782d..b36bcf2 100644 --- a/src/com/android/packageinstaller/PackageUtil.java +++ b/src/com/android/packageinstaller/PackageUtil.java @@ -118,29 +118,4 @@ 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 b80f8ef..f22cc28 100755 --- a/src/com/android/packageinstaller/UninstallerActivity.java +++ b/src/com/android/packageinstaller/UninstallerActivity.java @@ -19,6 +19,7 @@ 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; @@ -40,16 +41,59 @@ 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, @@ -58,32 +102,15 @@ public class UninstallerActivity extends Activity implements OnClickListener { startActivityForResult(newIntent, UNINSTALL_PROGRESS); } - private void startUninstallDone(boolean result) { + private void startUninstallDone() { Intent newIntent = new Intent(Intent.ACTION_VIEW); newIntent.putExtra(PackageUtil.INTENT_ATTR_APPLICATION_INFO, mAppInfo); - newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, result); + newIntent.putExtra(PackageUtil.INTENT_ATTR_INSTALL_STATUS, true); 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); @@ -93,7 +120,7 @@ public class UninstallerActivity extends Activity implements OnClickListener { String packageName = packageURI.getEncodedSchemeSpecificPart(); if(packageName == null) { Log.e(TAG, "Invalid package name:"+packageName); - displayErrorDialog(R.string.app_not_found_dlg_text); + showDialog(DLG_APP_NOT_FOUND); return; } //initialize package manager @@ -106,7 +133,7 @@ public class UninstallerActivity extends Activity implements OnClickListener { } if(mAppInfo == null || errFlag) { Log.e(TAG, "Invalid application:"+packageName); - displayErrorDialog(R.string.app_not_found_dlg_text); + showDialog(DLG_APP_NOT_FOUND); } else { requestWindowFeature(Window.FEATURE_NO_TITLE); //set view @@ -128,7 +155,11 @@ public class UninstallerActivity extends Activity implements OnClickListener { finish = false; mCurrentState = UNINSTALL_DONE; //start the next screen to show final status of installation - startUninstallDone(resultCode==UninstallAppProgress.SUCCEEDED); + if (resultCode==UninstallAppProgress.SUCCEEDED) { + startUninstallDone(); + } else { + showDialogInner(DLG_UNINSTALL_FAILED); + } break; case UNINSTALL_DONE: //neednt check for result code here |