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

Commit 67ded238 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch Committed by Android (Google) Code Review
Browse files

Merge "Allow APK install from anywhere, not just Downloads root"

parents 433d78a7 71bc9812
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -511,6 +511,14 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
            return;
            return;
        }
        }


        // For APKs, even if the type is preview, we send an ACTION_VIEW intent to allow
        // PackageManager to install it.  This allows users to install APKs from any root.
        // The Downloads special case is handled above in #manageDocument.
        if (MimeTypes.isApkType(doc.mimeType)) {
            viewDocument(doc);
            return;
        }

        switch (type) {
        switch (type) {
          case VIEW_TYPE_REGULAR:
          case VIEW_TYPE_REGULAR:
            if (viewDocument(doc)) {
            if (viewDocument(doc)) {
+9 −0
Original line number Original line Diff line number Diff line
@@ -333,6 +333,15 @@ public class ActionHandlerTest {
        mActivity.assertActivityStarted(DocumentsContract.ACTION_MANAGE_DOCUMENT);
        mActivity.assertActivityStarted(DocumentsContract.ACTION_MANAGE_DOCUMENT);
    }
    }


    @Test
    public void testDocumentPicked_Home_SendsActionViewForApks() throws Exception {
        mActivity.currentRoot = TestProvidersAccess.HOME;

        mHandler.openDocument(TestEnv.FILE_APK, ActionHandler.VIEW_TYPE_PREVIEW,
                ActionHandler.VIEW_TYPE_REGULAR);
        mActivity.assertActivityStarted(Intent.ACTION_VIEW);
    }

    @Test
    @Test
    public void testDocumentPicked_Downloads_ManagesPartialFiles() throws Exception {
    public void testDocumentPicked_Downloads_ManagesPartialFiles() throws Exception {
        mActivity.currentRoot = TestProvidersAccess.DOWNLOADS;
        mActivity.currentRoot = TestProvidersAccess.DOWNLOADS;