Restructure installer packages
This commit is contained in:
parent
50cd629d7d
commit
d530a1cf56
@ -302,7 +302,7 @@
|
|||||||
android:value=".SearchResults" />
|
android:value=".SearchResults" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".installer.InstallConfirmActivity"
|
android:name=".privileged.views.InstallConfirmActivity"
|
||||||
android:label="@string/menu_install"
|
android:label="@string/menu_install"
|
||||||
android:parentActivityName=".FDroid">
|
android:parentActivityName=".FDroid">
|
||||||
<meta-data
|
<meta-data
|
||||||
@ -390,10 +390,10 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<!-- Note: Theme.NoDisplay, this activity shows dialogs only -->
|
<!-- Note: Theme.NoDisplay, this activity shows dialogs only -->
|
||||||
<activity
|
<activity
|
||||||
android:name=".installer.InstallIntoSystemDialogActivity"
|
android:name=".privileged.install.InstallPrivilegedDialogActivity"
|
||||||
android:theme="@android:style/Theme.NoDisplay" />
|
android:theme="@android:style/Theme.NoDisplay" />
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".installer.InstallIntoSystemBootReceiver" >
|
android:name=".privileged.install.InstallPrivilegedBootReceiver" >
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
Defines the layout of a single permission item.
|
Defines the layout of a single permission item.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<view class="org.fdroid.fdroid.installer.AppSecurityPermissions$PermissionItemView"
|
<view class="org.fdroid.fdroid.privileged.views.AppSecurityPermissions$PermissionItemView"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
Defines the layout of a single permission item.
|
Defines the layout of a single permission item.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<view class="org.fdroid.fdroid.installer.AppSecurityPermissions$PermissionItemView"
|
<view class="org.fdroid.fdroid.privileged.views.AppSecurityPermissions$PermissionItemView"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
Defines the layout of a single permission item that costs money.
|
Defines the layout of a single permission item that costs money.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<view class="org.fdroid.fdroid.installer.AppSecurityPermissions$PermissionItemView"
|
<view class="org.fdroid.fdroid.privileged.views.AppSecurityPermissions$PermissionItemView"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<!--
|
<!--
|
||||||
This is the structure for the list of all permissions.
|
This is the structure for the list of all permissions.
|
||||||
-->
|
-->
|
||||||
<org.fdroid.fdroid.installer.CaffeinatedScrollView
|
<org.fdroid.fdroid.privileged.views.CaffeinatedScrollView
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/scrollview"
|
android:id="@+id/scrollview"
|
||||||
android:fillViewport="true">
|
android:fillViewport="true">
|
||||||
@ -50,4 +50,4 @@ This is the structure for the list of all permissions.
|
|||||||
android:text="@string/devicePerms" />
|
android:text="@string/devicePerms" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</org.fdroid.fdroid.installer.CaffeinatedScrollView>
|
</org.fdroid.fdroid.privileged.views.CaffeinatedScrollView>
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just a non-working implementation of this Stub to satisfy compiler!
|
|
||||||
*/
|
|
||||||
public interface IPackageDeleteObserver extends android.os.IInterface {
|
|
||||||
|
|
||||||
abstract class Stub extends android.os.Binder implements
|
|
||||||
android.content.pm.IPackageDeleteObserver {
|
|
||||||
public Stub() {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static android.content.pm.IPackageDeleteObserver asInterface(android.os.IBinder obj) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public android.os.IBinder asBinder() {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply,
|
|
||||||
int flags) throws android.os.RemoteException {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void packageDeleted(java.lang.String packageName, int returnCode)
|
|
||||||
throws android.os.RemoteException;
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Just a non-working implementation of this Stub to satisfy compiler!
|
|
||||||
*/
|
|
||||||
public interface IPackageInstallObserver extends android.os.IInterface {
|
|
||||||
|
|
||||||
abstract class Stub extends android.os.Binder implements
|
|
||||||
android.content.pm.IPackageInstallObserver {
|
|
||||||
public Stub() {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static android.content.pm.IPackageInstallObserver asInterface(android.os.IBinder obj) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public android.os.IBinder asBinder() {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply,
|
|
||||||
int flags) throws android.os.RemoteException {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void packageInstalled(java.lang.String packageName, int returnCode)
|
|
||||||
throws android.os.RemoteException;
|
|
||||||
}
|
|
@ -34,7 +34,6 @@ import android.support.v4.view.ViewPager;
|
|||||||
import android.support.v7.app.ActionBarActivity;
|
import android.support.v7.app.ActionBarActivity;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
@ -45,7 +44,7 @@ import android.widget.Toast;
|
|||||||
import org.fdroid.fdroid.compat.TabManager;
|
import org.fdroid.fdroid.compat.TabManager;
|
||||||
import org.fdroid.fdroid.data.AppProvider;
|
import org.fdroid.fdroid.data.AppProvider;
|
||||||
import org.fdroid.fdroid.data.NewRepoConfig;
|
import org.fdroid.fdroid.data.NewRepoConfig;
|
||||||
import org.fdroid.fdroid.installer.InstallIntoSystemDialogActivity;
|
import org.fdroid.fdroid.privileged.install.InstallPrivilegedDialogActivity;
|
||||||
import org.fdroid.fdroid.views.AppListFragmentPagerAdapter;
|
import org.fdroid.fdroid.views.AppListFragmentPagerAdapter;
|
||||||
import org.fdroid.fdroid.views.ManageReposActivity;
|
import org.fdroid.fdroid.views.ManageReposActivity;
|
||||||
import org.fdroid.fdroid.views.swap.SwapWorkflowActivity;
|
import org.fdroid.fdroid.views.swap.SwapWorkflowActivity;
|
||||||
@ -99,7 +98,7 @@ public class FDroid extends ActionBarActivity {
|
|||||||
Uri uri = AppProvider.getContentUri();
|
Uri uri = AppProvider.getContentUri();
|
||||||
getContentResolver().registerContentObserver(uri, true, new AppObserver());
|
getContentResolver().registerContentObserver(uri, true, new AppObserver());
|
||||||
|
|
||||||
InstallIntoSystemDialogActivity.firstTime(this);
|
InstallPrivilegedDialogActivity.firstTime(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,10 +39,10 @@ import java.util.List;
|
|||||||
* unattended installations.
|
* unattended installations.
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
||||||
public class DefaultInstallerSdk14 extends Installer {
|
public class DefaultSdk14Installer extends Installer {
|
||||||
private final Activity mActivity;
|
private final Activity mActivity;
|
||||||
|
|
||||||
public DefaultInstallerSdk14(Activity activity, PackageManager pm, InstallerCallback callback)
|
public DefaultSdk14Installer(Activity activity, PackageManager pm, InstallerCallback callback)
|
||||||
throws AndroidNotCompatibleException {
|
throws AndroidNotCompatibleException {
|
||||||
super(activity, pm, callback);
|
super(activity, pm, callback);
|
||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
@ -113,7 +113,7 @@ abstract public class Installer {
|
|||||||
Utils.DebugLog(TAG, "system permissions -> SystemInstaller");
|
Utils.DebugLog(TAG, "system permissions -> SystemInstaller");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return new SystemInstaller(activity, pm, callback);
|
return new PrivilegedInstaller(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
Log.e(TAG, "Android not compatible with SystemInstaller!", e);
|
Log.e(TAG, "Android not compatible with SystemInstaller!", e);
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ abstract public class Installer {
|
|||||||
try {
|
try {
|
||||||
Utils.DebugLog(TAG, "try default installer for Android >= 4");
|
Utils.DebugLog(TAG, "try default installer for Android >= 4");
|
||||||
|
|
||||||
return new DefaultInstallerSdk14(activity, pm, callback);
|
return new DefaultSdk14Installer(activity, pm, callback);
|
||||||
} catch (AndroidNotCompatibleException e) {
|
} catch (AndroidNotCompatibleException e) {
|
||||||
Log.e(TAG, "Android not compatible with DefaultInstallerSdk14!", e);
|
Log.e(TAG, "Android not compatible with DefaultInstallerSdk14!", e);
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,9 @@ import android.util.Log;
|
|||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
|
import org.fdroid.fdroid.privileged.views.AppDiff;
|
||||||
|
import org.fdroid.fdroid.privileged.views.AppSecurityPermissions;
|
||||||
|
import org.fdroid.fdroid.privileged.views.InstallConfirmActivity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -63,20 +66,20 @@ import java.util.List;
|
|||||||
* https://android.googlesource.com/platform
|
* https://android.googlesource.com/platform
|
||||||
* /frameworks/base/+/ccbf84f44c9e6a5ed3c08673614826bb237afc54
|
* /frameworks/base/+/ccbf84f44c9e6a5ed3c08673614826bb237afc54
|
||||||
*/
|
*/
|
||||||
public class SystemInstaller extends Installer {
|
public class PrivilegedInstaller extends Installer {
|
||||||
|
|
||||||
private static final String TAG = "SystemInstaller";
|
private static final String TAG = "PrivilegedInstaller";
|
||||||
|
|
||||||
private Activity mActivity;
|
private Activity mActivity;
|
||||||
private final PackageInstallObserver mInstallObserver;
|
// private final PackageInstallObserver mInstallObserver;
|
||||||
private final PackageDeleteObserver mDeleteObserver;
|
// private final PackageDeleteObserver mDeleteObserver;
|
||||||
private Method mInstallMethod;
|
// private Method mInstallMethod;
|
||||||
private Method mDeleteMethod;
|
// private Method mDeleteMethod;
|
||||||
|
|
||||||
public static final int REQUEST_CONFIRM_PERMS = 0;
|
public static final int REQUEST_CONFIRM_PERMS = 0;
|
||||||
|
|
||||||
public SystemInstaller(Activity activity, PackageManager pm,
|
public PrivilegedInstaller(Activity activity, PackageManager pm,
|
||||||
InstallerCallback callback) throws AndroidNotCompatibleException {
|
InstallerCallback callback) throws AndroidNotCompatibleException {
|
||||||
super(activity, pm, callback);
|
super(activity, pm, callback);
|
||||||
this.mActivity = activity;
|
this.mActivity = activity;
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.install;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -35,15 +35,15 @@ import eu.chainfire.libsuperuser.Shell;
|
|||||||
* http://omerjerk.in/2014/08/how-to-install-an-app-to-system-partition/
|
* http://omerjerk.in/2014/08/how-to-install-an-app-to-system-partition/
|
||||||
* https://github.com/omerjerk/RemoteDroid/blob/master/app/src/main/java/in/omerjerk/remotedroid/app/MainActivity.java
|
* https://github.com/omerjerk/RemoteDroid/blob/master/app/src/main/java/in/omerjerk/remotedroid/app/MainActivity.java
|
||||||
*/
|
*/
|
||||||
abstract class InstallIntoSystem {
|
abstract class InstallPrivileged {
|
||||||
|
|
||||||
protected final Context context;
|
protected final Context context;
|
||||||
|
|
||||||
public InstallIntoSystem(final Context context) {
|
public InstallPrivileged(final Context context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InstallIntoSystem create(final Context context) {
|
public static InstallPrivileged create(final Context context) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
return new LollipopImpl(context);
|
return new LollipopImpl(context);
|
||||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
@ -112,7 +112,7 @@ abstract class InstallIntoSystem {
|
|||||||
return commands;
|
return commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PreKitKatImpl extends InstallIntoSystem {
|
private static class PreKitKatImpl extends InstallPrivileged {
|
||||||
|
|
||||||
public PreKitKatImpl(Context context) {
|
public PreKitKatImpl(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -125,7 +125,7 @@ abstract class InstallIntoSystem {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class KitKatToLollipopImpl extends InstallIntoSystem {
|
private static class KitKatToLollipopImpl extends InstallPrivileged {
|
||||||
|
|
||||||
public KitKatToLollipopImpl(Context context) {
|
public KitKatToLollipopImpl(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -146,7 +146,7 @@ abstract class InstallIntoSystem {
|
|||||||
* History of PackageManagerService in Lollipop:
|
* History of PackageManagerService in Lollipop:
|
||||||
* https://github.com/android/platform_frameworks_base/commits/lollipop-release/services/core/java/com/android/server/pm/PackageManagerService.java
|
* https://github.com/android/platform_frameworks_base/commits/lollipop-release/services/core/java/com/android/server/pm/PackageManagerService.java
|
||||||
*/
|
*/
|
||||||
private static class LollipopImpl extends InstallIntoSystem {
|
private static class LollipopImpl extends InstallPrivileged {
|
||||||
|
|
||||||
public LollipopImpl(Context context) {
|
public LollipopImpl(Context context) {
|
||||||
super(context);
|
super(context);
|
@ -17,7 +17,7 @@
|
|||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.install;
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -25,7 +25,7 @@ import android.content.Intent;
|
|||||||
|
|
||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
|
|
||||||
public class InstallIntoSystemBootReceiver extends BroadcastReceiver {
|
public class InstallPrivilegedBootReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
@ -33,8 +33,8 @@ public class InstallIntoSystemBootReceiver extends BroadcastReceiver {
|
|||||||
if (Preferences.get().isPostSystemInstall()) {
|
if (Preferences.get().isPostSystemInstall()) {
|
||||||
Preferences.get().setPostSystemInstall(false);
|
Preferences.get().setPostSystemInstall(false);
|
||||||
|
|
||||||
Intent postInstall = new Intent(context.getApplicationContext(), InstallIntoSystemDialogActivity.class);
|
Intent postInstall = new Intent(context.getApplicationContext(), InstallPrivilegedDialogActivity.class);
|
||||||
postInstall.setAction(InstallIntoSystemDialogActivity.ACTION_POST_INSTALL);
|
postInstall.setAction(InstallPrivilegedDialogActivity.ACTION_POST_INSTALL);
|
||||||
postInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
postInstall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
context.startActivity(postInstall);
|
context.startActivity(postInstall);
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
* MA 02110-1301, USA.
|
* MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.install;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
@ -40,13 +40,14 @@ import org.fdroid.fdroid.FDroid;
|
|||||||
import org.fdroid.fdroid.FDroidApp;
|
import org.fdroid.fdroid.FDroidApp;
|
||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
|
import org.fdroid.fdroid.installer.Installer;
|
||||||
|
|
||||||
import eu.chainfire.libsuperuser.Shell;
|
import eu.chainfire.libsuperuser.Shell;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note: This activity has no view on its own, it displays consecutive dialogs.
|
* Note: This activity has no view on its own, it displays consecutive dialogs.
|
||||||
*/
|
*/
|
||||||
public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
public class InstallPrivilegedDialogActivity extends FragmentActivity {
|
||||||
|
|
||||||
private static final String TAG = "InstallIntoSystem";
|
private static final String TAG = "InstallIntoSystem";
|
||||||
|
|
||||||
@ -112,8 +113,8 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
if (false && probablyRoot) {
|
if (false && probablyRoot) {
|
||||||
// looks like we have root, at least su has a version number and is present
|
// looks like we have root, at least su has a version number and is present
|
||||||
|
|
||||||
Intent installIntent = new Intent(context, InstallIntoSystemDialogActivity.class);
|
Intent installIntent = new Intent(context, InstallPrivilegedDialogActivity.class);
|
||||||
installIntent.setAction(InstallIntoSystemDialogActivity.ACTION_FIRST_TIME);
|
installIntent.setAction(InstallPrivilegedDialogActivity.ACTION_FIRST_TIME);
|
||||||
installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
|
||||||
PendingIntent resultPendingIntent =
|
PendingIntent resultPendingIntent =
|
||||||
@ -157,7 +158,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId());
|
ContextThemeWrapper theme = new ContextThemeWrapper(this, FDroidApp.getCurThemeResId());
|
||||||
|
|
||||||
String message = getString(R.string.system_install_first_time_message) + "<br/><br/>" + InstallIntoSystem.create(getApplicationContext()).getWarningInfo();
|
String message = getString(R.string.system_install_first_time_message) + "<br/><br/>" + InstallPrivileged.create(getApplicationContext()).getWarningInfo();
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(theme)
|
AlertDialog.Builder builder = new AlertDialog.Builder(theme)
|
||||||
.setMessage(Html.fromHtml(message))
|
.setMessage(Html.fromHtml(message))
|
||||||
@ -170,8 +171,8 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
InstallIntoSystemDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
InstallPrivilegedDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
||||||
InstallIntoSystemDialogActivity.this.finish();
|
InstallPrivilegedDialogActivity.this.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
@ -188,7 +189,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
|
|
||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(InstallIntoSystemDialogActivity.this,
|
ContextThemeWrapper theme = new ContextThemeWrapper(InstallPrivilegedDialogActivity.this,
|
||||||
FDroidApp.getCurThemeResId());
|
FDroidApp.getCurThemeResId());
|
||||||
|
|
||||||
mProgressDialog = new ProgressDialog(theme);
|
mProgressDialog = new ProgressDialog(theme);
|
||||||
@ -224,7 +225,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
if (!ACTION_FIRST_TIME.equals(action)) {
|
if (!ACTION_FIRST_TIME.equals(action)) {
|
||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(InstallIntoSystemDialogActivity.this,
|
ContextThemeWrapper theme = new ContextThemeWrapper(InstallPrivilegedDialogActivity.this,
|
||||||
FDroidApp.getCurThemeResId());
|
FDroidApp.getCurThemeResId());
|
||||||
|
|
||||||
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(theme)
|
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(theme)
|
||||||
@ -233,8 +234,8 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
InstallIntoSystemDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
InstallPrivilegedDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
||||||
InstallIntoSystemDialogActivity.this.finish();
|
InstallPrivilegedDialogActivity.this.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
alertBuilder.create().show();
|
alertBuilder.create().show();
|
||||||
@ -254,7 +255,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
|
|
||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(InstallIntoSystemDialogActivity.this,
|
ContextThemeWrapper theme = new ContextThemeWrapper(InstallPrivilegedDialogActivity.this,
|
||||||
FDroidApp.getCurThemeResId());
|
FDroidApp.getCurThemeResId());
|
||||||
|
|
||||||
mProgressDialog = new ProgressDialog(theme);
|
mProgressDialog = new ProgressDialog(theme);
|
||||||
@ -266,7 +267,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
InstallIntoSystem.create(getApplicationContext()).runInstall();
|
InstallPrivileged.create(getApplicationContext()).runInstall();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -289,9 +290,9 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialogInterface, int i) {
|
public void onClick(DialogInterface dialogInterface, int i) {
|
||||||
InstallIntoSystemDialogActivity.this.setResult(success ? Activity.RESULT_OK : Activity.RESULT_CANCELED);
|
InstallPrivilegedDialogActivity.this.setResult(success ? Activity.RESULT_OK : Activity.RESULT_CANCELED);
|
||||||
InstallIntoSystemDialogActivity.this.finish();
|
InstallPrivilegedDialogActivity.this.finish();
|
||||||
startActivity(new Intent(InstallIntoSystemDialogActivity.this, FDroid.class));
|
startActivity(new Intent(InstallPrivilegedDialogActivity.this, FDroid.class));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setCancelable(false);
|
.setCancelable(false);
|
||||||
@ -317,8 +318,8 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
InstallIntoSystemDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
InstallPrivilegedDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
||||||
InstallIntoSystemDialogActivity.this.finish();
|
InstallPrivilegedDialogActivity.this.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
@ -329,8 +330,8 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
InstallIntoSystemDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
InstallPrivilegedDialogActivity.this.setResult(Activity.RESULT_CANCELED);
|
||||||
InstallIntoSystemDialogActivity.this.finish();
|
InstallPrivilegedDialogActivity.this.finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
@ -345,7 +346,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
super.onPreExecute();
|
super.onPreExecute();
|
||||||
|
|
||||||
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
// hack to get holo design (which is not automatically applied due to activity's Theme.NoDisplay
|
||||||
ContextThemeWrapper theme = new ContextThemeWrapper(InstallIntoSystemDialogActivity.this,
|
ContextThemeWrapper theme = new ContextThemeWrapper(InstallPrivilegedDialogActivity.this,
|
||||||
FDroidApp.getCurThemeResId());
|
FDroidApp.getCurThemeResId());
|
||||||
|
|
||||||
mProgressDialog = new ProgressDialog(theme);
|
mProgressDialog = new ProgressDialog(theme);
|
||||||
@ -357,7 +358,7 @@ public class InstallIntoSystemDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
InstallIntoSystem.create(getApplicationContext()).runUninstall();
|
InstallPrivileged.create(getApplicationContext()).runUninstall();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
|||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.views;
|
||||||
|
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
@ -25,10 +25,10 @@ import android.net.Uri;
|
|||||||
|
|
||||||
public class AppDiff {
|
public class AppDiff {
|
||||||
|
|
||||||
final PackageManager mPm;
|
public final PackageManager mPm;
|
||||||
final PackageInfo mPkgInfo;
|
public final PackageInfo mPkgInfo;
|
||||||
|
|
||||||
ApplicationInfo mInstalledAppInfo = null;
|
public ApplicationInfo mInstalledAppInfo = null;
|
||||||
|
|
||||||
public AppDiff(PackageManager mPm, Uri mPackageURI) {
|
public AppDiff(PackageManager mPm, Uri mPackageURI) {
|
||||||
this.mPm = mPm;
|
this.mPm = mPm;
|
@ -15,7 +15,7 @@
|
|||||||
** See the License for the specific language governing permissions and
|
** See the License for the specific language governing permissions and
|
||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.views;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -15,7 +15,7 @@
|
|||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.views;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
@ -16,7 +16,7 @@
|
|||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.views;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -14,7 +14,7 @@
|
|||||||
** See the License for the specific language governing permissions and
|
** See the License for the specific language governing permissions and
|
||||||
** limitations under the License.
|
** limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.fdroid.fdroid.installer;
|
package org.fdroid.fdroid.privileged.views;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
@ -19,7 +19,7 @@ import org.fdroid.fdroid.Preferences;
|
|||||||
import org.fdroid.fdroid.PreferencesActivity;
|
import org.fdroid.fdroid.PreferencesActivity;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.installer.InstallIntoSystemDialogActivity;
|
import org.fdroid.fdroid.privileged.install.InstallPrivilegedDialogActivity;
|
||||||
import org.fdroid.fdroid.installer.Installer;
|
import org.fdroid.fdroid.installer.Installer;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -221,8 +221,8 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
alertBuilder.setPositiveButton(R.string.system_permission_install_via_root, new DialogInterface.OnClickListener() {
|
alertBuilder.setPositiveButton(R.string.system_permission_install_via_root, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
Intent installIntent = new Intent(getActivity(), InstallIntoSystemDialogActivity.class);
|
Intent installIntent = new Intent(getActivity(), InstallPrivilegedDialogActivity.class);
|
||||||
installIntent.setAction(InstallIntoSystemDialogActivity.ACTION_INSTALL);
|
installIntent.setAction(InstallPrivilegedDialogActivity.ACTION_INSTALL);
|
||||||
startActivity(installIntent);
|
startActivity(installIntent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -249,8 +249,8 @@ public class PreferencesFragment extends PreferenceFragment
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
Intent uninstallIntent = new Intent(getActivity(), InstallIntoSystemDialogActivity.class);
|
Intent uninstallIntent = new Intent(getActivity(), InstallPrivilegedDialogActivity.class);
|
||||||
uninstallIntent.setAction(InstallIntoSystemDialogActivity.ACTION_UNINSTALL);
|
uninstallIntent.setAction(InstallPrivilegedDialogActivity.ACTION_UNINSTALL);
|
||||||
startActivity(uninstallIntent);
|
startActivity(uninstallIntent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user