Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50728943 authored by Vinod Krishnan's avatar Vinod Krishnan Committed by Android Git Automerger
Browse files

am 12c698b4: Merge "Block Install Intent for Wear devices" into cw-e-dev

* commit '12c698b4':
  Block Install Intent for Wear devices
parents 37a5aeb5 12c698b4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
-->

<resources>
    <style name="Theme.DialogWhenLarge" parent="@android:style/Theme.DeviceDefault.NoActionBar"/>

    <!-- START: Ported values -->
    <style name="TextAppearance.Wearable.Small" parent="android:TextAppearance.Medium">
        <item name="android:textSize">16sp</item>
+5 −0
Original line number Diff line number Diff line
@@ -274,4 +274,9 @@
         before permissions can be changed. [CHAR LIMIT=NONE] -->
    <string name="screen_overlay_button">Open settings</string>

    <!-- Title of dialog telling users that Install/Uninstall action is not supported on Android Wear. -->
    <string name="wear_not_allowed_dlg_title">Android Wear</string>
    <!-- Title of dialog telling users that Install/Uninstall action is not supported on Android Wear. -->
    <string name="wear_not_allowed_dlg_text">Instal/Uninstall actions not supported on Wear.</string>

</resources>
+6 −1
Original line number Diff line number Diff line
@@ -85,6 +85,11 @@ public class InstallFlowAnalytics implements Parcelable {
     */
    static final byte RESULT_PACKAGE_MANAGER_INSTALL_FAILED = 6;

    /**
     * Installation blocked since this feature is not allowed on Android Wear devices yet.
     */
    static final byte RESULT_NOT_ALLOWED_ON_WEAR = 7;

    private static final int FLAG_INSTALLS_FROM_UNKNOWN_SOURCES_PERMITTED = 1 << 0;
    private static final int FLAG_INSTALL_REQUEST_FROM_UNKNOWN_SOURCE = 1 << 1;
    private static final int FLAG_VERIFY_APPS_ENABLED = 1 << 2;
+21 −1
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
    private static final int DLG_INSTALL_ERROR = DLG_BASE + 4;
    private static final int DLG_ALLOW_SOURCE = DLG_BASE + 5;
    private static final int DLG_ADMIN_RESTRICTS_UNKNOWN_SOURCES = DLG_BASE + 6;
    private static final int DLG_NOT_SUPPORTED_ON_WEAR = DLG_BASE + 7;

    private void startInstallConfirm() {
        TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);
@@ -333,6 +334,18 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
                    })
                    .setOnCancelListener(this)
                    .create();
        case DLG_NOT_SUPPORTED_ON_WEAR:
            return new AlertDialog.Builder(this)
                    .setTitle(R.string.wear_not_allowed_dlg_title)
                    .setMessage(R.string.wear_not_allowed_dlg_text)
                    .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            setResult(RESULT_OK);
                            finish();
                        }
                    })
                    .setOnCancelListener(this)
                    .create();
       }
       return null;
   }
@@ -478,6 +491,13 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
        mInstallFlowAnalytics.setAppVerifierInstalled(isAppVerifierInstalled());
        mInstallFlowAnalytics.setPackageUri(mPackageURI.toString());

        if (DeviceUtils.isWear(this)) {
            showDialogInner(DLG_NOT_SUPPORTED_ON_WEAR);
            mInstallFlowAnalytics.setFlowFinished(
                    InstallFlowAnalytics.RESULT_NOT_ALLOWED_ON_WEAR);
            return;
        }

        final String scheme = mPackageURI.getScheme();
        if (scheme != null && !"file".equals(scheme) && !"package".equals(scheme)) {
            Log.w(TAG, "Unsupported scheme " + scheme);