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

Commit 231026e5 authored by Nihar Thakkar's avatar Nihar Thakkar
Browse files

Merge branch 'v1-nougat-apps' into 'master'

Don't build with system UID, check for permission instead of system app

See merge request e/apps/apps!6
parents abd5e6d8 cfb139e3
Loading
Loading
Loading
Loading
Loading
+1 −7
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ cache:
  paths:
  - .gradle/

build-without-auto-install:
build:
  stage: build
  script:
  - ./gradlew build
@@ -20,9 +20,3 @@ build-without-auto-install:
    paths:
    - app/build/outputs/apk/
  
 No newline at end of file
build:
  extends: build-without-auto-install
  script:
  - git apply auto-install.patch
  - ./gradlew build
  
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -10,8 +10,8 @@ android {
        applicationId "foundation.e.apps"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 5
        versionName "1.1.2"
        versionCode 6
        versionName "1.1.3"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
+5 −2
Original line number Diff line number Diff line
@@ -17,13 +17,15 @@

package foundation.e.apps.application.model

import android.Manifest
import android.app.PendingIntent
import android.content.*
import android.content.pm.PackageInstaller
import android.content.pm.PackageManager
import android.net.Uri
import android.support.v4.content.ContextCompat
import android.support.v4.content.FileProvider
import android.util.Log
import foundation.e.apps.utils.Common
import java.io.File
import java.io.IOException
import java.io.InputStream
@@ -37,7 +39,8 @@ class Installer(private val packageName: String,
    fun install(context: Context) {
        try {
            Log.i(TAG, "Installing $packageName")
            if (Common.isSystemApp(context.packageManager, context.packageName)) {
            if (ContextCompat.checkSelfPermission(context, Manifest.permission.INSTALL_PACKAGES)
                    == PackageManager.PERMISSION_GRANTED) {
                val inputStream = File(apk.absolutePath).inputStream()
                Log.i(TAG, "Opened input stream to $packageName APK")
                installApplication(context, inputStream)

auto-install.patch

deleted100644 → 0
+0 −14
Original line number Diff line number Diff line
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e3d84c2..a1a0c47 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -20,7 +20,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     package="foundation.e.apps"
-    android:installLocation="internalOnly">
+    android:installLocation="internalOnly"
+    android:sharedUserId="android.uid.system">
 
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />