Merge branch 'move-priv-extension' into 'master'

Move Privileged Extension to separate repo

Removes all files of the Privileged Extension app except the aidl files.

See merge request !371
This commit is contained in:
Daniel Martí 2016-08-02 09:24:31 +00:00
commit ba51536b88
42 changed files with 0 additions and 489 deletions

View File

@ -1,48 +0,0 @@
repositories {
jcenter()
}
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
dependencies {
compile project(':privileged-api-lib')
}
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 24
versionCode 1050
versionName "0.1"
}
compileOptions {
compileOptions.encoding = "UTF-8"
// Use Java 1.7, requires minSdk 8
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
// Do not abort build if lint finds errors
abortOnError false
}
}
checkstyle {
toolVersion = '7.1'
}
task checkstyle(type: Checkstyle) {
configFile file("${project.rootDir}/config/checkstyle/checkstyle.xml")
source 'src/main/java'
include '**/*.java'
classpath = files()
}

View File

@ -1,41 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.fdroid.fdroid.privileged">
<!-- These permissions are only granted when this apk is installed as a privileged app! -->
<uses-permission
android:name="android.permission.INSTALL_PACKAGES"
tools:ignore="ProtectedPermissions" />
<uses-permission
android:name="android.permission.DELETE_PACKAGES"
tools:ignore="ProtectedPermissions" />
<!--
Only apps signed with the same key can use this permission!
The permission is automatically granted independent of the install order
Never presented to the user due to the protectionLevel.
-->
<permission
android:name="org.fdroid.fdroid.privileged.USE_SERVICE"
android:protectionLevel="signature" />
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<service
android:name=".PrivilegedService"
android:enabled="true"
android:exported="true"
android:permission="org.fdroid.fdroid.privileged.USE_SERVICE"
android:process=":fdroid_privileged">
<intent-filter>
<action android:name="org.fdroid.fdroid.privileged.IPrivilegedService" />
</intent-filter>
</service>
</application>
</manifest>

View File

@ -1,54 +0,0 @@
/*
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package android.content.pm;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
/**
* Just a non-working implementation of this Stub to satisfy compiler!
*/
public interface IPackageDeleteObserver extends IInterface {
abstract class Stub extends Binder implements android.content.pm.IPackageDeleteObserver {
public Stub() {
throw new RuntimeException("Stub!");
}
public static IPackageDeleteObserver asInterface(IBinder obj) {
throw new RuntimeException("Stub!");
}
public IBinder asBinder() {
throw new RuntimeException("Stub!");
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
throw new RuntimeException("Stub!");
}
}
void packageDeleted(java.lang.String packageName, int returnCode) throws RemoteException;
}

View File

@ -1,54 +0,0 @@
/*
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package android.content.pm;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Parcel;
import android.os.RemoteException;
/**
* Just a non-working implementation of this Stub to satisfy compiler!
*/
public interface IPackageInstallObserver extends IInterface {
abstract class Stub extends Binder implements android.content.pm.IPackageInstallObserver {
public Stub() {
throw new RuntimeException("Stub!");
}
public static android.content.pm.IPackageInstallObserver asInterface(IBinder obj) {
throw new RuntimeException("Stub!");
}
public IBinder asBinder() {
throw new RuntimeException("Stub!");
}
public boolean onTransact(int code, Parcel data, Parcel reply, int flags)
throws RemoteException {
throw new RuntimeException("Stub!");
}
}
void packageInstalled(String packageName, int returnCode) throws RemoteException;
}

View File

@ -1,162 +0,0 @@
/*
* Copyright (C) 2015 Dominik Schürmann <dominik@dominikschuermann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
package org.fdroid.fdroid.privileged;
import android.Manifest;
import android.app.Service;
import android.content.Intent;
import android.content.pm.IPackageDeleteObserver;
import android.content.pm.IPackageInstallObserver;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import java.lang.reflect.Method;
/**
* This service provides an API via AIDL IPC for the main F-Droid app to install/delete packages.
*/
public class PrivilegedService extends Service {
private static final String TAG = "PrivilegedService";
private Method mInstallMethod;
private Method mDeleteMethod;
private boolean hasPrivilegedPermissionsImpl() {
boolean hasInstallPermission =
getPackageManager().checkPermission(Manifest.permission.INSTALL_PACKAGES, getPackageName())
== PackageManager.PERMISSION_GRANTED;
boolean hasDeletePermission =
getPackageManager().checkPermission(Manifest.permission.DELETE_PACKAGES, getPackageName())
== PackageManager.PERMISSION_GRANTED;
return hasInstallPermission && hasDeletePermission;
}
private void installPackageImpl(Uri packageURI, int flags, String installerPackageName,
final IPrivilegedCallback callback) {
// Internal callback from the system
IPackageInstallObserver.Stub installObserver = new IPackageInstallObserver.Stub() {
@Override
public void packageInstalled(String packageName, int returnCode) throws RemoteException {
// forward this internal callback to our callback
try {
callback.handleResult(packageName, returnCode);
} catch (RemoteException e1) {
Log.e(TAG, "RemoteException", e1);
}
}
};
// execute internal method
try {
mInstallMethod.invoke(getPackageManager(), packageURI, installObserver,
flags, installerPackageName);
} catch (Exception e) {
Log.e(TAG, "Android not compatible!", e);
try {
callback.handleResult(null, 0);
} catch (RemoteException e1) {
Log.e(TAG, "RemoteException", e1);
}
}
}
private void deletePackageImpl(String packageName, int flags, final IPrivilegedCallback callback) {
// Internal callback from the system
IPackageDeleteObserver.Stub deleteObserver = new IPackageDeleteObserver.Stub() {
@Override
public void packageDeleted(String packageName, int returnCode) throws RemoteException {
// forward this internal callback to our callback
try {
callback.handleResult(packageName, returnCode);
} catch (RemoteException e1) {
Log.e(TAG, "RemoteException", e1);
}
}
};
// execute internal method
try {
mDeleteMethod.invoke(getPackageManager(), packageName, deleteObserver, flags);
} catch (Exception e) {
Log.e(TAG, "Android not compatible!", e);
try {
callback.handleResult(null, 0);
} catch (RemoteException e1) {
Log.e(TAG, "RemoteException", e1);
}
}
}
private final IPrivilegedService.Stub mBinder = new IPrivilegedService.Stub() {
@Override
public boolean hasPrivilegedPermissions() {
return hasPrivilegedPermissionsImpl();
}
@Override
public void installPackage(Uri packageURI, int flags, String installerPackageName,
IPrivilegedCallback callback) {
installPackageImpl(packageURI, flags, installerPackageName, callback);
}
@Override
public void deletePackage(String packageName, int flags, IPrivilegedCallback callback) {
deletePackageImpl(packageName, flags, callback);
}
};
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public void onCreate() {
super.onCreate();
// get internal methods via reflection
try {
Class<?>[] installTypes = {
Uri.class, IPackageInstallObserver.class, int.class,
String.class,
};
Class<?>[] deleteTypes = {
String.class, IPackageDeleteObserver.class,
int.class,
};
PackageManager pm = getPackageManager();
mInstallMethod = pm.getClass().getMethod("installPackage", installTypes);
mDeleteMethod = pm.getClass().getMethod("deletePackage", deleteTypes);
} catch (NoSuchMethodException e) {
Log.e(TAG, "Android not compatible!", e);
stopSelf();
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">ملحقات أف-درويد المميز</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Estensión de F-Droid privilexáu</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Privilegierte F-Droid-Erweiterung</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Επέκταση του F-Droid με δικαιώματα συστήματος</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Privilegia F-Droid-aldonaĵo</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Extensión de F-Droid con permisos de sistema</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">F-Droid Priviligeeritud Laiendus</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Pribilegiodun F-Droid Luzapena</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">افزونهٔ ممتاز اف‌دروید</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">F-Droid Privileged Extension</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Estensione F-Droid con Privilegi</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">F-Droid Privileged Extension</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">F-Droid-tillegg med eleverte rettigheter</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Geprivilegieerde F-Droid-extensie</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">F-Droid Privileged Extension</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Extensão privilegiada F-Droid</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<resources><string name="app_name">Extensie privilegiata F-Droid</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Привилегированное расширение F-Droid</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">F-Droid privilegované rozšírenie</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Prapashtesa e privilegjuar F-Droid</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Повлашћено проширење за Ф-дроид</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">F-Droid Ayrıcalıklı Uzantı</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Привілейоване розширення F-Droid</string>
</resources>

View File

@ -1,4 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="app_name">Phần mở rộng F-Droid được cấp quyền</string>
</resources>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">F-Droid Privileged Extension</string>
</resources>

View File

@ -18,8 +18,6 @@ repositories {
}
dependencies {
compile project(':privileged-api-lib')
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:support-annotations:24.1.1'

View File

@ -1,18 +0,0 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 24
buildToolsVersion '24.0.1'
defaultConfig {
minSdkVersion 8
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
// Do not abort build if lint finds errors
lintOptions {
abortOnError false
}
}

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="org.fdroid.fdroid.privileged.api">
<application />
</manifest>

View File

@ -1,6 +1,4 @@
include ':app'
include ':Privileged-Extension'
include ':privileged-api-lib'
if (hasProperty('sourceDeps')) {
include ':extern:support-v4-preferencefragment'
include ':extern:nanohttpd:core'