Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
privileged-extension
privileged-extension
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 7
    • Issues 7
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • F-Droid
  • privileged-extensionprivileged-extension
  • Merge Requests
  • !3

Merged
Opened Aug 06, 2016 by relan@relan 
  • Report abuse
Report abuse

Add Android.mk

AOSP build system uses Android.mk files to determine how to build components. Having an Android.mk is necessary for inclusion into ROMs.

  • Discussion 23
  • Changes 3
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ resolvedCountText }} resolved
  • relan @relan commented · Aug 06, 2016
    Developer

    Marked this MR as WIP because it makes no sense without !1 (merged).

    Marked this MR as WIP because it makes no sense without !1.
  • Daniel Martí @mvdan commented · Aug 09, 2016

    Looks like @eighthave redid this work in !4 (merged).

    Looks like @eighthave redid this work in !4.
  • Hans-Christoph Steiner @eighthave commented · Aug 09, 2016
    Owner

    this does work without !1 (merged), so I would merge it before !1 (merged) while waiting for tests there. Do we definitely need to set the versionName in AndroidManifest.xml?

    this does work without !1, so I would merge it before !1 while waiting for tests there. Do we definitely need to set the versionName in _AndroidManifest.xml_?
  • Hans-Christoph Steiner @eighthave commented · Aug 09, 2016
    Owner

    I removed Android.mk from !4 (merged) to prefer this

    I removed _Android.mk_ from !4 to prefer this
  • Hans-Christoph Steiner @eighthave commented · Aug 09, 2016
    Owner

    @relan do you know how the Android.mk build process works here? Is it calling ant or gradle?

    @relan do you know how the _Android.mk_ build process works here? Is it calling _ant_ or _gradle_?
  • relan @relan commented · Aug 09, 2016
    Developer

    how the Android.mk build process works here? Is it calling ant or gradle?

    Neither. AOSP uses own, make-based build system. Android.mk is actually a Makefile containing all instructions needed to build a package.

    Do we definitely need to set the versionName in AndroidManifest.xml?

    Yes, because AOSP build system can take version code/name (and also min/target SDK) only from AndroidManifest.xml. In fact it just leaves it as is, while Gradle would process it and add appropriate tags/params.

    It's indeed possible to run arbitrary shell commands and call ant or gradle manually. But this is non-standard and very fragile way.

    Is version code/name in AndroidManifest.xml a problem?

    > how the Android.mk build process works here? Is it calling ant or gradle? Neither. AOSP uses own, make-based build system. Android.mk is actually a Makefile containing all instructions needed to build a package. > Do we definitely need to set the versionName in AndroidManifest.xml? Yes, because AOSP build system can take version code/name (and also min/target SDK) only from AndroidManifest.xml. In fact it just leaves it as is, while Gradle would process it and add appropriate tags/params. It's indeed possible to run arbitrary shell commands and call ant or gradle manually. But this is non-standard and very fragile way. Is version code/name in AndroidManifest.xml a problem?
  • Hans-Christoph Steiner @eighthave commented · Aug 09, 2016
    Owner

    I figured that Android.mk called gradle or ant, but I looked into the source code some, and it seems that you're right: they made a third APK build system in make.

    No problem about moving version code/name to AndroidManifest.xml, that just means ditching the gradle getVersionName() hack that I'm fond of.

    I figured that _Android.mk_ called gradle or ant, but I looked into the source code some, and it seems that you're right: they made a third APK build system in `make`. No problem about moving version code/name to _AndroidManifest.xml_, that just means ditching the gradle `getVersionName()` hack that I'm fond of.
  • relan @relan

    Added 6 commits:

    • bf48afb8...e4de1f1e - 4 commits from branch fdroid:master
    • 178d5441 - Add Android.mk
    • 7d90c524 - Move SDK and version attributes into the manifest
    · Aug 10, 2016

    Added 6 commits:

    • bf48afb8...e4de1f1e - 4 commits from branch fdroid:master
    • 178d5441 - Add Android.mk
    • 7d90c524 - Move SDK and version attributes into the manifest
    Added 6 commits: * bf48afb8...e4de1f1e - 4 commits from branch `fdroid:master` * 178d5441 - Add Android.mk * 7d90c524 - Move SDK and version attributes into the manifest
    Toggle commit list
  • relan @relan commented · Aug 10, 2016
    Developer

    Now I'm going to rebuild my ROM from scratch. I'll remove "WIP" after I make sure the Privileged Extension is integrated properly.

    Now I'm going to rebuild my ROM from scratch. I'll remove "WIP" after I make sure the Privileged Extension is integrated properly.
  • Hans-Christoph Steiner @eighthave commented · Aug 10, 2016
    Owner

    You should rebase this on the latest master since I just merged !1 (merged). Without that, you'll have to sign the F-Droid.apk using your ROM key to make it work with the Privileged Extension the way it was working before.

    Also, I've never written an Android.mk for building an APK before, but I did just look into how the standard system apps are built. It looks like your changes might need a few more things. Here's what I came up with:

    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    
    LOCAL_MODULE_TAGS := optional
    
    LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java)
    LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/src/main/res
    LOCAL_MANIFEST_FILE := $(LOCAL_PATH)/app/src/main/AndroidManifest.xml
    
    LOCAL_PACKAGE_NAME := FDroidPrivilegedExtension
    LOCAL_CERTIFICATE := platform
    LOCAL_PRIVILEGED_MODULE := true
    
    include $(BUILD_PACKAGE)
    Edited Aug 10, 2016 by Hans-Christoph Steiner
    You should rebase this on the latest master since I just merged !1. Without that, you'll have to sign the F-Droid.apk using your ROM key to make it work with the Privileged Extension the way it was working before. Also, I've never written an _Android.mk_ for building an APK before, but I did just look into how the standard system apps are built. It looks like your changes might need a few more things. Here's what I came up with: ```make LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java) LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/app/src/main/res LOCAL_MANIFEST_FILE := $(LOCAL_PATH)/app/src/main/AndroidManifest.xml LOCAL_PACKAGE_NAME := FDroidPrivilegedExtension LOCAL_CERTIFICATE := platform LOCAL_PRIVILEGED_MODULE := true include $(BUILD_PACKAGE) ```
  • Hans-Christoph Steiner @eighthave commented · Aug 10, 2016
    Owner

    Also, I'm OK with moving versionCode and versionName to AndroidManifest.xml if it must be that way, but I'd like to keep versionName getVersionName() in build.gradle since it generates nice version names based on git tags and commit IDs.

    Perhaps there is good a way to set versionName this way in Android.mk? If there is a standard make variable name for versionName, it can just be set using git describe --tags --always like in gradle. Or maybe we could just use a sed replace regexp. Based on looking at https://android.googlesource.com/platform/build/+/master/core/android_manifest.mk, it seems possible since its doing manifest merging. Automatically including the verisonName is going to be important as more ROMs integrate this since it will mean that the binary will have a built-in record of the exact version from git it is built from, making figuring out problems easier.

    Also, I'm OK with moving `versionCode` and `versionName` to _AndroidManifest.xml_ if it must be that way, but I'd like to keep `versionName getVersionName()` in _build.gradle_ since it generates nice version names based on git tags and commit IDs. Perhaps there is good a way to set `versionName` this way in _Android.mk_? If there is a standard make variable name for `versionName`, it can just be set using `git describe --tags --always` like in gradle. Or maybe we could just use a `sed` replace regexp. Based on looking at https://android.googlesource.com/platform/build/+/master/core/android_manifest.mk, it seems possible since its doing manifest merging. Automatically including the verisonName is going to be important as more ROMs integrate this since it will mean that the binary will have a built-in record of the exact version from git it is built from, making figuring out problems easier.
  • relan @relan

    Added 7 commits:

    • 7d90c524...00166eb2 - 5 commits from branch fdroid:master
    • 6b7cc911 - Add Android.mk
    • a3c2195e - Move SDK and version attributes into the manifest
    · Aug 11, 2016

    Added 7 commits:

    • 7d90c524...00166eb2 - 5 commits from branch fdroid:master
    • 6b7cc911 - Add Android.mk
    • a3c2195e - Move SDK and version attributes into the manifest
    Added 7 commits: * 7d90c524...00166eb2 - 5 commits from branch `fdroid:master` * 6b7cc911 - Add Android.mk * a3c2195e - Move SDK and version attributes into the manifest
    Toggle commit list
  • relan @relan

    Added 2 commits:

    • 39150dd8 - Add Android.mk
    • 95486fe3 - Move SDK and version attributes into the manifest
    · Aug 11, 2016

    Added 2 commits:

    • 39150dd8 - Add Android.mk
    • 95486fe3 - Move SDK and version attributes into the manifest
    Added 2 commits: * 39150dd8 - Add Android.mk * 95486fe3 - Move SDK and version attributes into the manifest
    Toggle commit list
  • relan @relan commented · Aug 11, 2016
    Developer

    It looks like your changes might need a few more things.

    AOSP build system is clever enough to find manifest and resources without explicit paths definitions. I've checked this making an AOSP 6.0.1 build.

    Perhaps there is good a way to set versionName this way in Android.mk?

    I don't know such a way. I would be surprised if it exists because AOSP is a solid thing, everything in it has the same version. It just doesn't need separate versioning of components.

    I'm not a big fan of git describe --tags --always trick because it won't work when building code from a tarball (F-Droid provides source tarballs for each app and this is the right thing). IMO build process should not depend on VCS.

    Currently I've got Privileged Extension built and integrated into the ROM and F-Droid 0.101-alpha4 is able to find and call it but then I get an uncaught remote exception:

    08-11 09:59:31.369   589  1089 I ActivityManager: Start proc 1673:org.fdroid.fdroid.privileged:fdroid_privileged/u0a6 for service org.fdroid.fdroid.privileged/.PrivilegedService
    08-11 09:59:31.490  1673  1673 W System  : ClassLoader referenced unknown path: /system/priv-app/FDroidPrivileged/lib/arm
    08-11 09:59:31.546  1673  1685 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid
    08-11 09:59:31.552  1673  1685 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 09:59:31.552  1673  1685 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 09:59:31.553  1673  1685 D PrivilegedExtension: Package is allowed to access the privileged extension!
    08-11 09:59:31.555  1673  1686 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid
    08-11 09:59:31.555  1673  1686 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 09:59:31.556  1673  1686 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 09:59:31.556  1673  1686 D PrivilegedExtension: Package is allowed to access the privileged extension!
    08-11 09:59:31.572   589   614 I ActivityManager: Start proc 1697:com.android.defcontainer/u0a3 for service com.android.defcontainer/.DefaultContainerService
    08-11 09:59:31.622  1697  1708 D DefContainer: Copying /data/user/0/org.fdroid.fdroid/files/install-1759028076.apk to base.apk
    08-11 09:59:31.678   198   198 I SELinux : SELinux: Loaded file_contexts contexts from /file_contexts.
    08-11 09:59:31.680   589   614 I PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl690655031.tmp/base.apk pkg=org.ligi.fast isa=arm vmSafeMode=false debuggable=false oatDir = /data/app/vmdl690655031.tmp/oat bootComplete=true
    08-11 09:59:31.762  1711  1711 I dex2oat : Starting dex2oat.
    08-11 09:59:31.991  1711  1711 I dex2oat : dex2oat took 231.842ms (threads: 4) arena alloc=1242KB java alloc=210KB native alloc=2MB free=2MB
    08-11 09:59:32.134   589   614 V BackupManagerService: restoreAtInstall pkg=org.ligi.fast token=1 restoreSet=0
    08-11 09:59:32.134   589   614 W BackupManagerService: Requested unavailable transport: android/com.android.internal.backup.LocalTransport
    08-11 09:59:32.134   589   614 W BackupManagerService: No transport
    08-11 09:59:32.134   589   614 V BackupManagerService: Finishing install immediately
    08-11 09:59:32.135   589   614 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
    08-11 09:59:32.135   589   614 I art     : Starting a blocking GC Explicit
    08-11 09:59:32.175   589   614 I art     : Explicit concurrent mark sweep GC freed 50580(3MB) AllocSpace objects, 18(348KB) LOS objects, 33% free, 12MB/18MB, paused 885us total 40.008ms
    08-11 09:59:32.176  1673  1685 E JavaBinder: *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
    08-11 09:59:32.176  1673  1685 E JavaBinder: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)"
    08-11 09:59:32.176  1673  1685 E JavaBinder:    at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689)
    08-11 09:59:32.176  1673  1685 E JavaBinder:    at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34)
    08-11 09:59:32.176  1673  1685 E JavaBinder:    at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79)
    08-11 09:59:32.176  1673  1685 E JavaBinder:    at android.os.Binder.execTransact(Binder.java:453)
    08-11 09:59:32.177  1673  1685 W System.err: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)"
    08-11 09:59:32.177  1673  1685 W System.err:    at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689)
    08-11 09:59:32.177  1673  1685 W System.err:    at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34)
    08-11 09:59:32.177  1673  1685 W System.err:    at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79)
    08-11 09:59:32.177  1673  1685 W System.err:    at android.os.Binder.execTransact(Binder.java:453)
    08-11 09:59:32.177  1673  1685 E JavaBinder: Forcefully exiting
    08-11 09:59:32.182  1061  1061 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_ADDED
    08-11 09:59:32.184  1061  1061 D CarrierServiceBindHelper: mHandler: 3
    08-11 09:59:32.184  1061  1061 D CarrierConfigLoader: mHandler: 9 phoneId: 0
    08-11 09:59:32.205   589   647 I InputReader: Reconfiguring input devices.  changes=0x00000010
    08-11 09:59:32.237   589   602 W Searchables: No global search activity found
    08-11 09:59:32.258   207   207 I Zygote  : Process 1673 exited cleanly (1)
    08-11 09:59:32.297   589   600 I ActivityManager: Process org.fdroid.fdroid.privileged:fdroid_privileged (pid 1673) has died
    08-11 09:59:32.298   589   600 W ActivityManager: Scheduling restart of crashed service org.fdroid.fdroid.privileged/.PrivilegedService in 1000ms

    AOSP code:

    4685    public void onPackageInstalled(String basePackageName, int returnCode, String msg,
    4686            Bundle extras) {
    4687        if (mLegacy == null) return;
    4688        try {
    4689            mLegacy.packageInstalled(basePackageName, returnCode);
    4690        } catch (RemoteException ignored) {
    4691        }
    4692    }
    > It looks like your changes might need a few more things. AOSP build system is clever enough to find manifest and resources without explicit paths definitions. I've checked this making an AOSP 6.0.1 build. > Perhaps there is good a way to set versionName this way in Android.mk? I don't know such a way. I would be surprised if it exists because AOSP is a solid thing, everything in it has the same version. It just doesn't need separate versioning of components. I'm not a big fan of `git describe --tags --always` trick because it won't work when building code from a tarball (F-Droid provides source tarballs for each app and this is the right thing). IMO build process should not depend on VCS. Currently I've got Privileged Extension built and integrated into the ROM and F-Droid 0.101-alpha4 is able to find and call it but then I get an uncaught remote exception: ``` 08-11 09:59:31.369 589 1089 I ActivityManager: Start proc 1673:org.fdroid.fdroid.privileged:fdroid_privileged/u0a6 for service org.fdroid.fdroid.privileged/.PrivilegedService 08-11 09:59:31.490 1673 1673 W System : ClassLoader referenced unknown path: /system/priv-app/FDroidPrivileged/lib/arm 08-11 09:59:31.546 1673 1685 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid 08-11 09:59:31.552 1673 1685 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 09:59:31.552 1673 1685 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 09:59:31.553 1673 1685 D PrivilegedExtension: Package is allowed to access the privileged extension! 08-11 09:59:31.555 1673 1686 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid 08-11 09:59:31.555 1673 1686 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 09:59:31.556 1673 1686 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 09:59:31.556 1673 1686 D PrivilegedExtension: Package is allowed to access the privileged extension! 08-11 09:59:31.572 589 614 I ActivityManager: Start proc 1697:com.android.defcontainer/u0a3 for service com.android.defcontainer/.DefaultContainerService 08-11 09:59:31.622 1697 1708 D DefContainer: Copying /data/user/0/org.fdroid.fdroid/files/install-1759028076.apk to base.apk 08-11 09:59:31.678 198 198 I SELinux : SELinux: Loaded file_contexts contexts from /file_contexts. 08-11 09:59:31.680 589 614 I PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl690655031.tmp/base.apk pkg=org.ligi.fast isa=arm vmSafeMode=false debuggable=false oatDir = /data/app/vmdl690655031.tmp/oat bootComplete=true 08-11 09:59:31.762 1711 1711 I dex2oat : Starting dex2oat. 08-11 09:59:31.991 1711 1711 I dex2oat : dex2oat took 231.842ms (threads: 4) arena alloc=1242KB java alloc=210KB native alloc=2MB free=2MB 08-11 09:59:32.134 589 614 V BackupManagerService: restoreAtInstall pkg=org.ligi.fast token=1 restoreSet=0 08-11 09:59:32.134 589 614 W BackupManagerService: Requested unavailable transport: android/com.android.internal.backup.LocalTransport 08-11 09:59:32.134 589 614 W BackupManagerService: No transport 08-11 09:59:32.134 589 614 V BackupManagerService: Finishing install immediately 08-11 09:59:32.135 589 614 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value. 08-11 09:59:32.135 589 614 I art : Starting a blocking GC Explicit 08-11 09:59:32.175 589 614 I art : Explicit concurrent mark sweep GC freed 50580(3MB) AllocSpace objects, 18(348KB) LOS objects, 33% free, 12MB/18MB, paused 885us total 40.008ms 08-11 09:59:32.176 1673 1685 E JavaBinder: *** Uncaught remote exception! (Exceptions are not yet supported across processes.) 08-11 09:59:32.176 1673 1685 E JavaBinder: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)" 08-11 09:59:32.176 1673 1685 E JavaBinder: at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689) 08-11 09:59:32.176 1673 1685 E JavaBinder: at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34) 08-11 09:59:32.176 1673 1685 E JavaBinder: at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79) 08-11 09:59:32.176 1673 1685 E JavaBinder: at android.os.Binder.execTransact(Binder.java:453) 08-11 09:59:32.177 1673 1685 W System.err: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)" 08-11 09:59:32.177 1673 1685 W System.err: at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689) 08-11 09:59:32.177 1673 1685 W System.err: at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34) 08-11 09:59:32.177 1673 1685 W System.err: at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79) 08-11 09:59:32.177 1673 1685 W System.err: at android.os.Binder.execTransact(Binder.java:453) 08-11 09:59:32.177 1673 1685 E JavaBinder: Forcefully exiting 08-11 09:59:32.182 1061 1061 D CarrierServiceBindHelper: Receive action: android.intent.action.PACKAGE_ADDED 08-11 09:59:32.184 1061 1061 D CarrierServiceBindHelper: mHandler: 3 08-11 09:59:32.184 1061 1061 D CarrierConfigLoader: mHandler: 9 phoneId: 0 08-11 09:59:32.205 589 647 I InputReader: Reconfiguring input devices. changes=0x00000010 08-11 09:59:32.237 589 602 W Searchables: No global search activity found 08-11 09:59:32.258 207 207 I Zygote : Process 1673 exited cleanly (1) 08-11 09:59:32.297 589 600 I ActivityManager: Process org.fdroid.fdroid.privileged:fdroid_privileged (pid 1673) has died 08-11 09:59:32.298 589 600 W ActivityManager: Scheduling restart of crashed service org.fdroid.fdroid.privileged/.PrivilegedService in 1000ms ``` AOSP code: ```java 4685 public void onPackageInstalled(String basePackageName, int returnCode, String msg, 4686 Bundle extras) { 4687 if (mLegacy == null) return; 4688 try { 4689 mLegacy.packageInstalled(basePackageName, returnCode); 4690 } catch (RemoteException ignored) { 4691 } 4692 } ```
  • Dominik Schürmann @dschuermann commented · Aug 11, 2016
    Developer

    @relan Good point about the automated version tags, then I would also advise against using this method, especially for the privileged extension as it will be build inside a rom, potentially not from the git directly.

    Regarding the problem: Sounds like the AIDL files have not been packaged correctly or something along these lines. Are you sure that proguard is disabled? I will check later in detail.

    @relan Good point about the automated version tags, then I would also advise against using this method, especially for the privileged extension as it will be build inside a rom, potentially not from the git directly. Regarding the problem: Sounds like the AIDL files have not been packaged correctly or something along these lines. Are you sure that proguard is disabled? I will check later in detail.
  • Dominik Schürmann @dschuermann commented · Aug 11, 2016
    Developer

    @relan A better idea: Can you try removing the file in https://gitlab.com/fdroid/privileged-extension/tree/master/app/src/main/java/android/content/pm please and then rebuild the rom. They are just abstract and stubs to satisfy the compiler when the extension is build outside of a rom.

    @relan A better idea: Can you try removing the file in https://gitlab.com/fdroid/privileged-extension/tree/master/app/src/main/java/android/content/pm please and then rebuild the rom. They are just abstract and stubs to satisfy the compiler when the extension is build outside of a rom.
  • relan @relan commented · Aug 11, 2016
    Developer

    Without AIDL files Privileged Extension wouldn't work at all. But it does install an app and then crashes. I'll check you idea about ProGuard (not sure whether build system calls it on its own).

    Can you try removing the file in https://gitlab.com/fdroid/privileged-extension/tree/master/app/src/main/java/android/content/pm please and then rebuild the rom.

    Still no luck (looks like the issue is the same):

    08-11 12:08:21.636  1959  1975 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid
    08-11 12:08:21.643  1959  1975 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 12:08:21.643  1959  1975 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 12:08:21.643  1959  1975 D PrivilegedExtension: Package is allowed to access the privileged extension!
    08-11 12:08:21.646  1959  1974 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid
    08-11 12:08:21.647  1959  1974 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 12:08:21.647  1959  1974 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab
    08-11 12:08:21.647  1959  1974 D PrivilegedExtension: Package is allowed to access the privileged extension!
    08-11 12:08:21.672  1678  1690 D DefContainer: Copying /data/user/0/org.fdroid.fdroid/files/install-1697840141.apk to base.apk
    08-11 12:08:22.244   195   195 I SELinux : SELinux: Loaded file_contexts contexts from /file_contexts.
    08-11 12:08:22.246   591   617 I PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl1871454346.tmp/base.apk pkg=nl.mpcjanssen.simpletask isa=arm vmSafeMode=false debuggable=false oatDir = /data/app/vmdl1871454346.tmp/oat bootComplete=true
    08-11 12:08:22.340  2141  2141 I dex2oat : Starting dex2oat.
    08-11 12:08:22.878  2141  2141 W dex2oat : Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    08-11 12:08:23.038  2141  2145 W dex2oat : Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
    08-11 12:08:26.398  2141  2145 W dex2oat : No verified method for method calling String.<init>: void org.json.JSONStringer.<init>(int)
    08-11 12:08:26.927  2141  2144 W dex2oat : No verified method for method calling String.<init>: java.lang.String java.io.ByteArrayOutputStream.toString()
    08-11 12:08:26.998  2141  2143 W dex2oat : No verified method for method calling String.<init>: java.lang.String java.io.ByteArrayOutputStream.toString()
    08-11 12:08:27.992  2141  2141 I dex2oat : dex2oat took 5.655s (threads: 4) arena alloc=3MB java alloc=5MB native alloc=20MB free=4MB
    08-11 12:08:28.018   591   617 W PackageManager: Package nl.mpcjanssen.simpletask desires unavailable shared library com.sec.android.app.multiwindow; ignoring!
    08-11 12:08:28.167   591   617 V BackupManagerService: restoreAtInstall pkg=nl.mpcjanssen.simpletask token=1 restoreSet=0
    08-11 12:08:28.167   591   617 W BackupManagerService: Requested unavailable transport: android/com.android.internal.backup.LocalTransport
    08-11 12:08:28.168   591   617 W BackupManagerService: No transport
    08-11 12:08:28.168   591   617 V BackupManagerService: Finishing install immediately
    08-11 12:08:28.168   591   617 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value.
    08-11 12:08:28.168   591   617 I art     : Starting a blocking GC Explicit
    08-11 12:08:28.219   591   617 I art     : Explicit concurrent mark sweep GC freed 78234(4MB) AllocSpace objects, 19(920KB) LOS objects, 33% free, 12MB/18MB, paused 1.007ms total 50.415ms
    08-11 12:08:28.221  1959  1975 E JavaBinder: *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
    08-11 12:08:28.221  1959  1975 E JavaBinder: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)"
    08-11 12:08:28.221  1959  1975 E JavaBinder:    at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689)
    08-11 12:08:28.221  1959  1975 E JavaBinder:    at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34)
    08-11 12:08:28.221  1959  1975 E JavaBinder:    at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79)
    08-11 12:08:28.221  1959  1975 E JavaBinder:    at android.os.Binder.execTransact(Binder.java:453)
    08-11 12:08:28.221  1959  1975 W System.err: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)"
    08-11 12:08:28.221  1959  1975 W System.err:    at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689)
    08-11 12:08:28.221  1959  1975 W System.err:    at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34)
    08-11 12:08:28.221  1959  1975 W System.err:    at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79)
    08-11 12:08:28.221  1959  1975 W System.err:    at android.os.Binder.execTransact(Binder.java:453)
    08-11 12:08:28.221  1959  1975 E JavaBinder: Forcefully exiting
    08-11 12:08:28.302   204   204 I Zygote  : Process 1959 exited cleanly (1)
    08-11 12:08:28.341   591  1114 I ActivityManager: Process org.fdroid.fdroid.privileged:fdroid_privileged (pid 1959) has died
    08-11 12:08:28.341   591  1114 W ActivityManager: Scheduling restart of crashed service org.fdroid.fdroid.privileged/.PrivilegedService in 1000ms
    Without AIDL files Privileged Extension wouldn't work at all. But it does install an app and then crashes. I'll check you idea about ProGuard (not sure whether build system calls it on its own). > Can you try removing the file in https://gitlab.com/fdroid/privileged-extension/tree/master/app/src/main/java/android/content/pm please and then rebuild the rom. Still no luck (looks like the issue is the same): ``` 08-11 12:08:21.636 1959 1975 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid 08-11 12:08:21.643 1959 1975 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 12:08:21.643 1959 1975 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 12:08:21.643 1959 1975 D PrivilegedExtension: Package is allowed to access the privileged extension! 08-11 12:08:21.646 1959 1974 D PrivilegedExtension: Checking if package is allowed to access privileged extension: org.fdroid.fdroid 08-11 12:08:21.647 1959 1974 D PrivilegedExtension: Allowed cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 12:08:21.647 1959 1974 D PrivilegedExtension: Package cert hash: 43238d512c1e5eb2d6569f4a3afbf5523418b82e0a3ed1552770abb9a9c9ccab 08-11 12:08:21.647 1959 1974 D PrivilegedExtension: Package is allowed to access the privileged extension! 08-11 12:08:21.672 1678 1690 D DefContainer: Copying /data/user/0/org.fdroid.fdroid/files/install-1697840141.apk to base.apk 08-11 12:08:22.244 195 195 I SELinux : SELinux: Loaded file_contexts contexts from /file_contexts. 08-11 12:08:22.246 591 617 I PackageManager.DexOptimizer: Running dexopt (dex2oat) on: /data/app/vmdl1871454346.tmp/base.apk pkg=nl.mpcjanssen.simpletask isa=arm vmSafeMode=false debuggable=false oatDir = /data/app/vmdl1871454346.tmp/oat bootComplete=true 08-11 12:08:22.340 2141 2141 I dex2oat : Starting dex2oat. 08-11 12:08:22.878 2141 2141 W dex2oat : Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 08-11 12:08:23.038 2141 2145 W dex2oat : Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 08-11 12:08:26.398 2141 2145 W dex2oat : No verified method for method calling String.<init>: void org.json.JSONStringer.<init>(int) 08-11 12:08:26.927 2141 2144 W dex2oat : No verified method for method calling String.<init>: java.lang.String java.io.ByteArrayOutputStream.toString() 08-11 12:08:26.998 2141 2143 W dex2oat : No verified method for method calling String.<init>: java.lang.String java.io.ByteArrayOutputStream.toString() 08-11 12:08:27.992 2141 2141 I dex2oat : dex2oat took 5.655s (threads: 4) arena alloc=3MB java alloc=5MB native alloc=20MB free=4MB 08-11 12:08:28.018 591 617 W PackageManager: Package nl.mpcjanssen.simpletask desires unavailable shared library com.sec.android.app.multiwindow; ignoring! 08-11 12:08:28.167 591 617 V BackupManagerService: restoreAtInstall pkg=nl.mpcjanssen.simpletask token=1 restoreSet=0 08-11 12:08:28.167 591 617 W BackupManagerService: Requested unavailable transport: android/com.android.internal.backup.LocalTransport 08-11 12:08:28.168 591 617 W BackupManagerService: No transport 08-11 12:08:28.168 591 617 V BackupManagerService: Finishing install immediately 08-11 12:08:28.168 591 617 W Settings: Setting install_non_market_apps has moved from android.provider.Settings.Global to android.provider.Settings.Secure, returning read-only value. 08-11 12:08:28.168 591 617 I art : Starting a blocking GC Explicit 08-11 12:08:28.219 591 617 I art : Explicit concurrent mark sweep GC freed 78234(4MB) AllocSpace objects, 19(920KB) LOS objects, 33% free, 12MB/18MB, paused 1.007ms total 50.415ms 08-11 12:08:28.221 1959 1975 E JavaBinder: *** Uncaught remote exception! (Exceptions are not yet supported across processes.) 08-11 12:08:28.221 1959 1975 E JavaBinder: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)" 08-11 12:08:28.221 1959 1975 E JavaBinder: at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689) 08-11 12:08:28.221 1959 1975 E JavaBinder: at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34) 08-11 12:08:28.221 1959 1975 E JavaBinder: at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79) 08-11 12:08:28.221 1959 1975 E JavaBinder: at android.os.Binder.execTransact(Binder.java:453) 08-11 12:08:28.221 1959 1975 W System.err: java.lang.AbstractMethodError: abstract method "void android.content.pm.IPackageInstallObserver.packageInstalled(java.lang.String, int)" 08-11 12:08:28.221 1959 1975 W System.err: at android.content.pm.PackageManager$LegacyPackageInstallObserver.onPackageInstalled(PackageManager.java:4689) 08-11 12:08:28.221 1959 1975 W System.err: at android.app.PackageInstallObserver$1.onPackageInstalled(PackageInstallObserver.java:34) 08-11 12:08:28.221 1959 1975 W System.err: at android.content.pm.IPackageInstallObserver2$Stub.onTransact(IPackageInstallObserver2.java:79) 08-11 12:08:28.221 1959 1975 W System.err: at android.os.Binder.execTransact(Binder.java:453) 08-11 12:08:28.221 1959 1975 E JavaBinder: Forcefully exiting 08-11 12:08:28.302 204 204 I Zygote : Process 1959 exited cleanly (1) 08-11 12:08:28.341 591 1114 I ActivityManager: Process org.fdroid.fdroid.privileged:fdroid_privileged (pid 1959) has died 08-11 12:08:28.341 591 1114 W ActivityManager: Scheduling restart of crashed service org.fdroid.fdroid.privileged/.PrivilegedService in 1000ms ```
  • Dominik Schürmann @dschuermann commented · Aug 11, 2016
    Developer

    @relan I searched a little bit on the Internet, and indeed proguard could be the problem, as described in one of the comments on https://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/

    @relan I searched a little bit on the Internet, and indeed proguard could be the problem, as described in one of the comments on https://paulononaka.wordpress.com/2011/07/02/how-to-install-a-application-in-background-on-android/
  • Dominik Schürmann @dschuermann commented · Aug 11, 2016
    Developer

    should help for gradle:

    buildTypes {
        release {
            minifyEnabled false
        }
    }
    Edited Aug 11, 2016 by Dominik Schürmann
    should help for gradle: ``` buildTypes { release { minifyEnabled false } } ```
  • Hans-Christoph Steiner @eighthave commented · Aug 11, 2016
    Owner

    Does anyone really ever build ROMs from anything but repo, which is git? I've never heard of building a ROM without using repo. git is really an integral part of the ROM building process.

    Also, I think minifyEnabled doesn't always cover proguard. I think it needs to be something like this:

    android {
        buildTypes {
            all {
                minifyEnabled false
                useProguard false
                shrinkResources false
             }
        }
    }
    Does anyone really ever build ROMs from anything but `repo`, which is git? I've never heard of building a ROM without using `repo`. `git` is really an integral part of the ROM building process. Also, I think `minifyEnabled` doesn't always cover proguard. I think it needs to be something like this: ```gradle android { buildTypes { all { minifyEnabled false useProguard false shrinkResources false } } } ```
  • Hans-Christoph Steiner @eighthave

    mentioned in commit eighthave/fdroidclient@19f90bbd

    · Aug 11, 2016

    mentioned in commit eighthave/fdroidclient@19f90bbd

    mentioned in commit eighthave/fdroidclient@19f90bbdbf5fcb8524b68c3dd691ca3da41cad52
    Toggle commit list
  • relan @relan

    Added 3 commits:

    • e3cf082f - Add Android.mk
    • 10a5565e - Move SDK and version attributes into the manifest
    • 5eeb0f77 - Disable ProGuard
    · Aug 11, 2016

    Added 3 commits:

    • e3cf082f - Add Android.mk
    • 10a5565e - Move SDK and version attributes into the manifest
    • 5eeb0f77 - Disable ProGuard
    Added 3 commits: * e3cf082f - Add Android.mk * 10a5565e - Move SDK and version attributes into the manifest * 5eeb0f77 - Disable ProGuard
    Toggle commit list
  • relan @relan commented · Aug 11, 2016
    Developer

    Yes, ProGuard was the problem. I've disabled it completely because it does not make much sense for such a small project. Now F-Droid 0.101-alpha4 installs and removes apps via the Privileged Extension just fine.

    Also changed the APK name to FDroidPrivilegedExtension.

    Does anyone really ever build ROMs from anything but repo, which is git?

    I can imagine someone doing repo sync on one machine, copying source code tree (just code, no .git subdirs) to another machine without Internet connection and building there.

    How do Copperhead guys build their Android?

    Yes, ProGuard was the problem. I've disabled it completely because it does not make much sense for such a small project. Now F-Droid 0.101-alpha4 installs and removes apps via the Privileged Extension just fine. Also changed the APK name to FDroidPrivilegedExtension. > Does anyone really ever build ROMs from anything but `repo`, which is git? I can imagine someone doing `repo sync` on one machine, copying source code tree (just code, no `.git` subdirs) to another machine without Internet connection and building there. How do Copperhead guys build their Android?
  • relan @relan

    Unmarked this merge request as a Work In Progress

    · Aug 11, 2016

    Unmarked this merge request as a Work In Progress

    Unmarked this merge request as a Work In Progress
    Toggle commit list
  • Dominik Schürmann @dschuermann commented · Aug 11, 2016
    Developer

    I can imagine someone doing repo sync on one machine, copying source code tree (just code, no .git subdirs) to another machine without Internet connection and building there.

    Exactly. I don't see the problem of increasing versionName manually before creating a git tag. It avoids the usage of specialized gradle code.

    I am okay with merging this. Thanks for the testing @relan

    > I can imagine someone doing repo sync on one machine, copying source code tree (just code, no .git subdirs) to another machine without Internet connection and building there. Exactly. I don't see the problem of increasing versionName manually before creating a git tag. It avoids the usage of specialized gradle code. I am okay with merging this. Thanks for the testing @relan
  • Dominik Schürmann
    @dschuermann started a discussion on the diff Aug 11, 2016
    Last updated by relan Aug 12, 2016
    app/build.gradle
    43 29 targetCompatibility JavaVersion.VERSION_1_7
    44 30 }
    45 31
    32 buildTypes {
    33 all {
    34 minifyEnabled false
    • Dominik Schürmann @dschuermann commented · Aug 11, 2016
      Developer

      Would be nice to have a comment here why proguard must be disabled.

      Would be nice to have a comment here why proguard _must_ be disabled.
    • relan @relan commented · Aug 12, 2016
      Developer

      Done. Thanks for your hints!

      Done. Thanks for your hints!
    Please register or sign in to reply
  • relan @relan

    Added 1 commit:

    • 5c58c3e3 - Disable ProGuard
    · Aug 12, 2016

    Added 1 commit:

    • 5c58c3e3 - Disable ProGuard
    Added 1 commit: * 5c58c3e3 - Disable ProGuard
    Toggle commit list
  • relan @relan commented · Aug 12, 2016
    Developer

    I think @eighthave's concern about versioning can be addressed in a different way. We can adopt something like Git flow model:

    1. ROMs developers use master branch of the Privileged Extension repository.
    2. Privileged Extension is developed in the develop branch, master always contains the latest stable code.
    3. When a new version is ready, develop is merged into master. So ROMs should never get a half-baked version of the Privileged Extension.
    I think @eighthave's concern about versioning can be addressed in a different way. We can adopt something like [Git flow](http://nvie.com/posts/a-successful-git-branching-model/) model: 1. ROMs developers use `master` branch of the Privileged Extension repository. 2. Privileged Extension is developed in the `develop` branch, `master` always contains the latest stable code. 3. When a new version is ready, `develop` is merged into `master`. So ROMs should never get a half-baked version of the Privileged Extension.
  • Hans-Christoph Steiner @eighthave commented · Aug 12, 2016
    Owner

    No git workflow will address the issue I'm concerned about, I moved that discussion to a new issue: #8

    As for "git flow", that model is vastly overcomplicated for a project of this size. This project only has linear, fast-forward progress in commits, we do not need bugfix versions of stable release. Even with fdroidclient, which is a lot more complicated than this, there is hardly any activity on the stable release branches, and we only support one stable branch at a time. And git flow is too complicated for fdroidclient too.

    No git workflow will address the issue I'm concerned about, I moved that discussion to a new issue: https://gitlab.com/fdroid/privileged-extension/issues/8 As for "git flow", that model is vastly overcomplicated for a project of this size. This project only has linear, fast-forward progress in commits, we do not need bugfix versions of stable release. Even with fdroidclient, which is a lot more complicated than this, there is hardly any activity on the stable release branches, and we only support one stable branch at a time. And git flow is too complicated for fdroidclient too.
  • Hans-Christoph Steiner @eighthave

    mentioned in commit eighthave/fdroidclient@7afee40d

    · Aug 12, 2016

    mentioned in commit eighthave/fdroidclient@7afee40d

    mentioned in commit eighthave/fdroidclient@7afee40d8f72cadc3de53f133126e69acd70a8d2
    Toggle commit list
  • Hans-Christoph Steiner @eighthave

    mentioned in commit 3c6b2c60

    · Aug 12, 2016

    mentioned in commit 3c6b2c60

    mentioned in commit 3c6b2c602b760fcf3d07ee343d44b3dd03ee4ae6
    Toggle commit list
  • Hans-Christoph Steiner @eighthave

    Status changed to merged

    · Aug 12, 2016

    Status changed to merged

    Status changed to merged
    Toggle commit list
  • Hans-Christoph Steiner @eighthave

    Mentioned in commit belos/Belmarket@bc19a72d

    · Oct 25, 2016

    Mentioned in commit belos/Belmarket@bc19a72d

    Mentioned in commit belos/Belmarket@bc19a72de5eabdc12a2a4ac7c7a8480462b66fbf
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Assignee
No assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
0
Labels
None
Assign labels
  • View project labels
Reference: fdroid/privileged-extension!3

Revert this merge request

This will create a new commit in order to revert the existing changes.

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.

Cherry-pick this merge request

Switch branch
Cancel
A new branch will be created in your fork and a new merge request will be started.