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

Commit 71bc9812 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

Allow APK install from anywhere, not just Downloads root

Fixes: 69851225
Test: ActionHandlerTest / manual
Change-Id: I1a009014fdec86ec5b61243f64b06b3b19d1dce4
parent 42053493
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -511,6 +511,14 @@ public class ActionHandler<T extends Activity & Addons> extends AbstractActionHa
            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) {
          case VIEW_TYPE_REGULAR:
            if (viewDocument(doc)) {
+9 −0
Original line number Diff line number Diff line
@@ -333,6 +333,15 @@ public class ActionHandlerTest {
        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
    public void testDocumentPicked_Downloads_ManagesPartialFiles() throws Exception {
        mActivity.currentRoot = TestProvidersAccess.DOWNLOADS;