Loading res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -53,10 +53,10 @@ <string name="install_failed_blocked">The package was blocked from being installed.</string> <!-- Reason displayed when installation fails because the package conflicts with an existing application (e.g., incompatible certificates) [CHAR LIMIT=100] --> <string name="install_failed_conflict">The package conflicts with an existing package by the same name.</string> <string name="install_failed_conflict">App not installed as package conflicts with an existing package.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current tablet (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> <string name="install_failed_incompatible" product="tablet">This app isn\'t <string name="install_failed_incompatible" product="tablet">App not installed as app isn\'t compatible with your tablet.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current TV (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> Loading @@ -64,11 +64,11 @@ compatible with your TV.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current phone (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> <string name="install_failed_incompatible" product="default">This app isn\'t <string name="install_failed_incompatible" product="default">App not installed as app isn\'t compatible with your phone.</string> <!-- Reason displayed when installation fails because the installation package itself is invalid in some way (e.g., corrupt) [CHAR LIMIT=100] --> <string name="install_failed_invalid_apk">The package appears to be corrupt.</string> <string name="install_failed_invalid_apk">App not installed as package appears to be invalid.</string> <!-- Message presented when an application could not be installed on the tablet for some reason. [CHAR LIMIT=100] --> <string name="install_failed_msg" product="tablet"><xliff:g id="app_name">%1$s</xliff:g> couldn\'t be installed on your tablet.</string> <!-- Message presented when an application could not be installed on the TV for some reason. [CHAR LIMIT=100] --> Loading src/com/android/packageinstaller/InstallAppProgress.java +16 −10 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.packageinstaller; import static android.content.pm.PackageInstaller.SessionParams.UID_UNKNOWN; import android.annotation.Nullable; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; Loading Loading @@ -105,7 +106,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener mProgressBar.setVisibility(View.GONE); // Show the ok button int centerTextLabel; int centerExplanationLabel = -1; String centerExplanationLabel = null; if (msg.arg1 == PackageInstaller.STATUS_SUCCESS) { mLaunchButton.setVisibility(View.VISIBLE); ((ImageView)findViewById(R.id.center_icon)) Loading @@ -131,14 +132,17 @@ public class InstallAppProgress extends Activity implements View.OnClickListener showDialogInner(DLG_OUT_OF_SPACE); return; } else { String statusMessage = (String) msg.obj; // Generic error handling for all other error codes. ((ImageView)findViewById(R.id.center_icon)) .setImageDrawable(getDrawable(R.drawable.ic_report_problem_92)); centerExplanationLabel = getExplanationFromErrorCode(msg.arg1); centerTextLabel = R.string.install_failed; centerTextLabel = getExplanationFromErrorCode(msg.arg1); if (statusMessage != null) { centerExplanationLabel = statusMessage; } mLaunchButton.setVisibility(View.GONE); } if (centerExplanationLabel != -1) { if (centerExplanationLabel != null) { mExplanationTextView.setText(centerExplanationLabel); findViewById(R.id.center_view).setVisibility(View.GONE); ((TextView)findViewById(R.id.explanation_status)).setText(centerTextLabel); Loading @@ -165,7 +169,8 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if (statusCode == PackageInstaller.STATUS_PENDING_USER_ACTION) { context.startActivity((Intent)intent.getParcelableExtra(Intent.EXTRA_INTENT)); } else { onPackageInstalled(statusCode); onPackageInstalled(statusCode, intent.getStringExtra( PackageInstaller.EXTRA_STATUS_MESSAGE)); } } }; Loading @@ -182,7 +187,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener case PackageInstaller.STATUS_FAILURE_INVALID: return R.string.install_failed_invalid_apk; default: return -1; return R.string.install_failed; } } Loading Loading @@ -250,9 +255,10 @@ public class InstallAppProgress extends Activity implements View.OnClickListener showDialog(id); } void onPackageInstalled(int statusCode) { void onPackageInstalled(int statusCode, @Nullable String statusMessage) { Message msg = mHandler.obtainMessage(INSTALL_COMPLETE); msg.arg1 = statusCode; msg.obj = statusMessage; mHandler.sendMessage(msg); } Loading Loading @@ -307,7 +313,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener PendingIntent.FLAG_UPDATE_CURRENT); session.commit(pendingIntent.getIntentSender()); } catch (IOException e) { onPackageInstalled(PackageInstaller.STATUS_FAILURE); onPackageInstalled(PackageInstaller.STATUS_FAILURE, null); } finally { IoUtils.closeQuietly(session); } Loading Loading @@ -345,9 +351,9 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if ("package".equals(mPackageURI.getScheme())) { try { pm.installExistingPackage(mAppInfo.packageName); onPackageInstalled(PackageInstaller.STATUS_SUCCESS); onPackageInstalled(PackageInstaller.STATUS_SUCCESS, null); } catch (PackageManager.NameNotFoundException e) { onPackageInstalled(PackageInstaller.STATUS_FAILURE_INVALID); onPackageInstalled(PackageInstaller.STATUS_FAILURE_INVALID, null); } } else { final PackageInstaller.SessionParams params = new PackageInstaller.SessionParams( Loading Loading
res/values/strings.xml +4 −4 Original line number Diff line number Diff line Loading @@ -53,10 +53,10 @@ <string name="install_failed_blocked">The package was blocked from being installed.</string> <!-- Reason displayed when installation fails because the package conflicts with an existing application (e.g., incompatible certificates) [CHAR LIMIT=100] --> <string name="install_failed_conflict">The package conflicts with an existing package by the same name.</string> <string name="install_failed_conflict">App not installed as package conflicts with an existing package.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current tablet (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> <string name="install_failed_incompatible" product="tablet">This app isn\'t <string name="install_failed_incompatible" product="tablet">App not installed as app isn\'t compatible with your tablet.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current TV (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> Loading @@ -64,11 +64,11 @@ compatible with your TV.</string> <!-- Reason displayed when installation fails because the package is incompatible with the current phone (e.g., missing native code for the current ABI, newer SDK, ...) [CHAR LIMIT=100] --> <string name="install_failed_incompatible" product="default">This app isn\'t <string name="install_failed_incompatible" product="default">App not installed as app isn\'t compatible with your phone.</string> <!-- Reason displayed when installation fails because the installation package itself is invalid in some way (e.g., corrupt) [CHAR LIMIT=100] --> <string name="install_failed_invalid_apk">The package appears to be corrupt.</string> <string name="install_failed_invalid_apk">App not installed as package appears to be invalid.</string> <!-- Message presented when an application could not be installed on the tablet for some reason. [CHAR LIMIT=100] --> <string name="install_failed_msg" product="tablet"><xliff:g id="app_name">%1$s</xliff:g> couldn\'t be installed on your tablet.</string> <!-- Message presented when an application could not be installed on the TV for some reason. [CHAR LIMIT=100] --> Loading
src/com/android/packageinstaller/InstallAppProgress.java +16 −10 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.packageinstaller; import static android.content.pm.PackageInstaller.SessionParams.UID_UNKNOWN; import android.annotation.Nullable; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; Loading Loading @@ -105,7 +106,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener mProgressBar.setVisibility(View.GONE); // Show the ok button int centerTextLabel; int centerExplanationLabel = -1; String centerExplanationLabel = null; if (msg.arg1 == PackageInstaller.STATUS_SUCCESS) { mLaunchButton.setVisibility(View.VISIBLE); ((ImageView)findViewById(R.id.center_icon)) Loading @@ -131,14 +132,17 @@ public class InstallAppProgress extends Activity implements View.OnClickListener showDialogInner(DLG_OUT_OF_SPACE); return; } else { String statusMessage = (String) msg.obj; // Generic error handling for all other error codes. ((ImageView)findViewById(R.id.center_icon)) .setImageDrawable(getDrawable(R.drawable.ic_report_problem_92)); centerExplanationLabel = getExplanationFromErrorCode(msg.arg1); centerTextLabel = R.string.install_failed; centerTextLabel = getExplanationFromErrorCode(msg.arg1); if (statusMessage != null) { centerExplanationLabel = statusMessage; } mLaunchButton.setVisibility(View.GONE); } if (centerExplanationLabel != -1) { if (centerExplanationLabel != null) { mExplanationTextView.setText(centerExplanationLabel); findViewById(R.id.center_view).setVisibility(View.GONE); ((TextView)findViewById(R.id.explanation_status)).setText(centerTextLabel); Loading @@ -165,7 +169,8 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if (statusCode == PackageInstaller.STATUS_PENDING_USER_ACTION) { context.startActivity((Intent)intent.getParcelableExtra(Intent.EXTRA_INTENT)); } else { onPackageInstalled(statusCode); onPackageInstalled(statusCode, intent.getStringExtra( PackageInstaller.EXTRA_STATUS_MESSAGE)); } } }; Loading @@ -182,7 +187,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener case PackageInstaller.STATUS_FAILURE_INVALID: return R.string.install_failed_invalid_apk; default: return -1; return R.string.install_failed; } } Loading Loading @@ -250,9 +255,10 @@ public class InstallAppProgress extends Activity implements View.OnClickListener showDialog(id); } void onPackageInstalled(int statusCode) { void onPackageInstalled(int statusCode, @Nullable String statusMessage) { Message msg = mHandler.obtainMessage(INSTALL_COMPLETE); msg.arg1 = statusCode; msg.obj = statusMessage; mHandler.sendMessage(msg); } Loading Loading @@ -307,7 +313,7 @@ public class InstallAppProgress extends Activity implements View.OnClickListener PendingIntent.FLAG_UPDATE_CURRENT); session.commit(pendingIntent.getIntentSender()); } catch (IOException e) { onPackageInstalled(PackageInstaller.STATUS_FAILURE); onPackageInstalled(PackageInstaller.STATUS_FAILURE, null); } finally { IoUtils.closeQuietly(session); } Loading Loading @@ -345,9 +351,9 @@ public class InstallAppProgress extends Activity implements View.OnClickListener if ("package".equals(mPackageURI.getScheme())) { try { pm.installExistingPackage(mAppInfo.packageName); onPackageInstalled(PackageInstaller.STATUS_SUCCESS); onPackageInstalled(PackageInstaller.STATUS_SUCCESS, null); } catch (PackageManager.NameNotFoundException e) { onPackageInstalled(PackageInstaller.STATUS_FAILURE_INVALID); onPackageInstalled(PackageInstaller.STATUS_FAILURE_INVALID, null); } } else { final PackageInstaller.SessionParams params = new PackageInstaller.SessionParams( Loading