Fix pmd errors and code style
This commit is contained in:
parent
d3a7107a0f
commit
f860257826
@ -42,12 +42,12 @@ public class ApkSignatureVerifier {
|
|||||||
|
|
||||||
private static final String TAG = "ApkSignatureVerifier";
|
private static final String TAG = "ApkSignatureVerifier";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context context;
|
||||||
private final PackageManager mPm;
|
private final PackageManager pm;
|
||||||
|
|
||||||
ApkSignatureVerifier(Context context) {
|
ApkSignatureVerifier(Context context) {
|
||||||
mContext = context;
|
this.context = context;
|
||||||
mPm = context.getPackageManager();
|
pm = context.getPackageManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasFDroidSignature(File apkFile) {
|
public boolean hasFDroidSignature(File apkFile) {
|
||||||
@ -66,7 +66,7 @@ public class ApkSignatureVerifier {
|
|||||||
|
|
||||||
private byte[] getApkSignature(File apkFile) {
|
private byte[] getApkSignature(File apkFile) {
|
||||||
final String pkgPath = apkFile.getAbsolutePath();
|
final String pkgPath = apkFile.getAbsolutePath();
|
||||||
PackageInfo pkgInfo = mPm.getPackageArchiveInfo(pkgPath, PackageManager.GET_SIGNATURES);
|
PackageInfo pkgInfo = pm.getPackageArchiveInfo(pkgPath, PackageManager.GET_SIGNATURES);
|
||||||
return signatureToBytes(pkgInfo.signatures);
|
return signatureToBytes(pkgInfo.signatures);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ public class ApkSignatureVerifier {
|
|||||||
try {
|
try {
|
||||||
// we do check the byte array of *all* signatures
|
// we do check the byte array of *all* signatures
|
||||||
@SuppressLint("PackageManagerGetSignatures")
|
@SuppressLint("PackageManagerGetSignatures")
|
||||||
PackageInfo pkgInfo = mPm.getPackageInfo(mContext.getPackageName(),
|
PackageInfo pkgInfo = pm.getPackageInfo(context.getPackageName(),
|
||||||
PackageManager.GET_SIGNATURES);
|
PackageManager.GET_SIGNATURES);
|
||||||
return signatureToBytes(pkgInfo.signatures);
|
return signatureToBytes(pkgInfo.signatures);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
|
@ -45,7 +45,7 @@ public class DefaultInstaller extends Installer {
|
|||||||
|
|
||||||
Uri sanitizedUri;
|
Uri sanitizedUri;
|
||||||
try {
|
try {
|
||||||
sanitizedUri = Installer.prepareApkFile(mContext, uri, packageName);
|
sanitizedUri = Installer.prepareApkFile(context, uri, packageName);
|
||||||
} catch (Installer.InstallFailedException e) {
|
} catch (Installer.InstallFailedException e) {
|
||||||
Log.e(TAG, "prepareApkFile failed", e);
|
Log.e(TAG, "prepareApkFile failed", e);
|
||||||
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
||||||
@ -53,13 +53,13 @@ public class DefaultInstaller extends Installer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent installIntent = new Intent(mContext, DefaultInstallerActivity.class);
|
Intent installIntent = new Intent(context, DefaultInstallerActivity.class);
|
||||||
installIntent.setAction(DefaultInstallerActivity.ACTION_INSTALL_PACKAGE);
|
installIntent.setAction(DefaultInstallerActivity.ACTION_INSTALL_PACKAGE);
|
||||||
installIntent.putExtra(DefaultInstallerActivity.EXTRA_ORIGINATING_URI, originatingUri);
|
installIntent.putExtra(DefaultInstallerActivity.EXTRA_ORIGINATING_URI, originatingUri);
|
||||||
installIntent.setData(sanitizedUri);
|
installIntent.setData(sanitizedUri);
|
||||||
|
|
||||||
PendingIntent installPendingIntent = PendingIntent.getActivity(
|
PendingIntent installPendingIntent = PendingIntent.getActivity(
|
||||||
mContext.getApplicationContext(),
|
context.getApplicationContext(),
|
||||||
uri.hashCode(),
|
uri.hashCode(),
|
||||||
installIntent,
|
installIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
@ -72,12 +72,12 @@ public class DefaultInstaller extends Installer {
|
|||||||
protected void uninstallPackage(String packageName) {
|
protected void uninstallPackage(String packageName) {
|
||||||
sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_STARTED);
|
sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_STARTED);
|
||||||
|
|
||||||
Intent uninstallIntent = new Intent(mContext, DefaultInstallerActivity.class);
|
Intent uninstallIntent = new Intent(context, DefaultInstallerActivity.class);
|
||||||
uninstallIntent.setAction(DefaultInstallerActivity.ACTION_UNINSTALL_PACKAGE);
|
uninstallIntent.setAction(DefaultInstallerActivity.ACTION_UNINSTALL_PACKAGE);
|
||||||
uninstallIntent.putExtra(
|
uninstallIntent.putExtra(
|
||||||
DefaultInstallerActivity.EXTRA_UNINSTALL_PACKAGE_NAME, packageName);
|
DefaultInstallerActivity.EXTRA_UNINSTALL_PACKAGE_NAME, packageName);
|
||||||
PendingIntent uninstallPendingIntent = PendingIntent.getActivity(
|
PendingIntent uninstallPendingIntent = PendingIntent.getActivity(
|
||||||
mContext.getApplicationContext(),
|
context.getApplicationContext(),
|
||||||
packageName.hashCode(),
|
packageName.hashCode(),
|
||||||
uninstallIntent,
|
uninstallIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
@ -31,7 +31,6 @@ import android.support.v4.app.FragmentActivity;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.Utils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A transparent activity as a wrapper around AOSP's PackageInstaller Intents
|
* A transparent activity as a wrapper around AOSP's PackageInstaller Intents
|
||||||
@ -48,10 +47,10 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
private static final int REQUEST_CODE_INSTALL = 0;
|
private static final int REQUEST_CODE_INSTALL = 0;
|
||||||
private static final int REQUEST_CODE_UNINSTALL = 1;
|
private static final int REQUEST_CODE_UNINSTALL = 1;
|
||||||
|
|
||||||
private Uri mInstallOriginatingUri;
|
private Uri installOriginatingUri;
|
||||||
private Uri mInstallUri;
|
private Uri installUri;
|
||||||
|
|
||||||
private String mUninstallPackageName;
|
private String uninstallPackageName;
|
||||||
|
|
||||||
// for the broadcasts
|
// for the broadcasts
|
||||||
private DefaultInstaller installer;
|
private DefaultInstaller installer;
|
||||||
@ -66,17 +65,17 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case ACTION_INSTALL_PACKAGE: {
|
case ACTION_INSTALL_PACKAGE: {
|
||||||
mInstallUri = intent.getData();
|
installUri = intent.getData();
|
||||||
mInstallOriginatingUri = intent.getParcelableExtra(EXTRA_ORIGINATING_URI);
|
installOriginatingUri = intent.getParcelableExtra(EXTRA_ORIGINATING_URI);
|
||||||
|
|
||||||
installPackage(mInstallUri, mInstallOriginatingUri);
|
installPackage(installUri, installOriginatingUri);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ACTION_UNINSTALL_PACKAGE: {
|
case ACTION_UNINSTALL_PACKAGE: {
|
||||||
mUninstallPackageName = intent.getStringExtra(EXTRA_UNINSTALL_PACKAGE_NAME);
|
uninstallPackageName = intent.getStringExtra(EXTRA_UNINSTALL_PACKAGE_NAME);
|
||||||
|
|
||||||
uninstallPackage(mUninstallPackageName);
|
uninstallPackage(uninstallPackageName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@ -87,8 +86,6 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
private void installPackage(Uri uri, Uri originatingUri) {
|
private void installPackage(Uri uri, Uri originatingUri) {
|
||||||
Utils.debugLog(TAG, "Installing from " + uri);
|
|
||||||
|
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
throw new RuntimeException("Set the data uri to point to an apk location!");
|
throw new RuntimeException("Set the data uri to point to an apk location!");
|
||||||
}
|
}
|
||||||
@ -135,13 +132,11 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
"This Android rom does not support ACTION_INSTALL_PACKAGE!");
|
"This Android rom does not support ACTION_INSTALL_PACKAGE!");
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_STARTED);
|
Installer.ACTION_INSTALL_STARTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void uninstallPackage(String packageName) {
|
protected void uninstallPackage(String packageName) {
|
||||||
Intent intent = new Intent();
|
|
||||||
|
|
||||||
// check that the package is installed
|
// check that the package is installed
|
||||||
try {
|
try {
|
||||||
getPackageManager().getPackageInfo(packageName, 0);
|
getPackageManager().getPackageInfo(packageName, 0);
|
||||||
@ -154,6 +149,7 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Uri uri = Uri.fromParts("package", packageName, null);
|
Uri uri = Uri.fromParts("package", packageName, null);
|
||||||
|
Intent intent = new Intent();
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
@ -183,33 +179,33 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
* never executed on Androids < 4.0
|
* never executed on Androids < 4.0
|
||||||
*/
|
*/
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_COMPLETE);
|
Installer.ACTION_INSTALL_COMPLETE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback on N for https://gitlab.com/fdroid/fdroidclient/issues/631
|
// Fallback on N for https://gitlab.com/fdroid/fdroidclient/issues/631
|
||||||
if ("N".equals(Build.VERSION.CODENAME)) {
|
if ("N".equals(Build.VERSION.CODENAME)) {
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_COMPLETE);
|
Installer.ACTION_INSTALL_COMPLETE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (resultCode) {
|
switch (resultCode) {
|
||||||
case Activity.RESULT_OK: {
|
case Activity.RESULT_OK: {
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_COMPLETE);
|
Installer.ACTION_INSTALL_COMPLETE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Activity.RESULT_CANCELED: {
|
case Activity.RESULT_CANCELED: {
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_INTERRUPTED);
|
Installer.ACTION_INSTALL_INTERRUPTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
case Activity.RESULT_FIRST_USER:
|
||||||
case Activity.RESULT_FIRST_USER: {
|
default: {
|
||||||
// AOSP returns Activity.RESULT_FIRST_USER on error
|
// AOSP returns Activity.RESULT_FIRST_USER on error
|
||||||
installer.sendBroadcastInstall(mInstallUri, mInstallOriginatingUri,
|
installer.sendBroadcastInstall(installUri, installOriginatingUri,
|
||||||
Installer.ACTION_INSTALL_INTERRUPTED,
|
Installer.ACTION_INSTALL_INTERRUPTED,
|
||||||
getString(R.string.install_error_unknown));
|
getString(R.string.install_error_unknown));
|
||||||
break;
|
break;
|
||||||
@ -221,26 +217,26 @@ public class DefaultInstallerActivity extends FragmentActivity {
|
|||||||
case REQUEST_CODE_UNINSTALL: {
|
case REQUEST_CODE_UNINSTALL: {
|
||||||
// resultCode is always 0 on Android < 4.0.
|
// resultCode is always 0 on Android < 4.0.
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||||
installer.sendBroadcastUninstall(mUninstallPackageName,
|
installer.sendBroadcastUninstall(uninstallPackageName,
|
||||||
Installer.ACTION_UNINSTALL_COMPLETE);
|
Installer.ACTION_UNINSTALL_COMPLETE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (resultCode) {
|
switch (resultCode) {
|
||||||
case Activity.RESULT_OK: {
|
case Activity.RESULT_OK: {
|
||||||
installer.sendBroadcastUninstall(mUninstallPackageName,
|
installer.sendBroadcastUninstall(uninstallPackageName,
|
||||||
Installer.ACTION_UNINSTALL_COMPLETE);
|
Installer.ACTION_UNINSTALL_COMPLETE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Activity.RESULT_CANCELED: {
|
case Activity.RESULT_CANCELED: {
|
||||||
installer.sendBroadcastUninstall(mUninstallPackageName,
|
installer.sendBroadcastUninstall(uninstallPackageName,
|
||||||
Installer.ACTION_UNINSTALL_INTERRUPTED);
|
Installer.ACTION_UNINSTALL_INTERRUPTED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
case Activity.RESULT_FIRST_USER:
|
||||||
case Activity.RESULT_FIRST_USER: {
|
default: {
|
||||||
// AOSP UninstallAppProgress returns RESULT_FIRST_USER on error
|
// AOSP UninstallAppProgress returns RESULT_FIRST_USER on error
|
||||||
installer.sendBroadcastUninstall(mUninstallPackageName,
|
installer.sendBroadcastUninstall(uninstallPackageName,
|
||||||
Installer.ACTION_UNINSTALL_INTERRUPTED,
|
Installer.ACTION_UNINSTALL_INTERRUPTED,
|
||||||
getString(R.string.uninstall_error_unknown));
|
getString(R.string.uninstall_error_unknown));
|
||||||
break;
|
break;
|
||||||
|
@ -45,7 +45,7 @@ public class ExtensionInstaller extends Installer {
|
|||||||
protected void installPackage(Uri uri, Uri originatingUri, String packageName) {
|
protected void installPackage(Uri uri, Uri originatingUri, String packageName) {
|
||||||
Uri sanitizedUri;
|
Uri sanitizedUri;
|
||||||
try {
|
try {
|
||||||
sanitizedUri = Installer.prepareApkFile(mContext, uri, packageName);
|
sanitizedUri = Installer.prepareApkFile(context, uri, packageName);
|
||||||
} catch (InstallFailedException e) {
|
} catch (InstallFailedException e) {
|
||||||
Log.e(TAG, "prepareApkFile failed", e);
|
Log.e(TAG, "prepareApkFile failed", e);
|
||||||
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
||||||
@ -55,17 +55,17 @@ public class ExtensionInstaller extends Installer {
|
|||||||
|
|
||||||
// extension must be signed with the same public key as main F-Droid
|
// extension must be signed with the same public key as main F-Droid
|
||||||
// NOTE: Disabled for debug builds to be able to use official extension from repo
|
// NOTE: Disabled for debug builds to be able to use official extension from repo
|
||||||
ApkSignatureVerifier signatureVerifier = new ApkSignatureVerifier(mContext);
|
ApkSignatureVerifier signatureVerifier = new ApkSignatureVerifier(context);
|
||||||
if (!BuildConfig.DEBUG && !signatureVerifier.hasFDroidSignature(new File(sanitizedUri.getPath()))) {
|
if (!BuildConfig.DEBUG && !signatureVerifier.hasFDroidSignature(new File(sanitizedUri.getPath()))) {
|
||||||
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
||||||
"APK signature of extension not correct!");
|
"APK signature of extension not correct!");
|
||||||
}
|
}
|
||||||
Intent installIntent = new Intent(mContext, InstallExtensionDialogActivity.class);
|
Intent installIntent = new Intent(context, InstallExtensionDialogActivity.class);
|
||||||
installIntent.setAction(InstallExtensionDialogActivity.ACTION_INSTALL);
|
installIntent.setAction(InstallExtensionDialogActivity.ACTION_INSTALL);
|
||||||
installIntent.setData(sanitizedUri);
|
installIntent.setData(sanitizedUri);
|
||||||
|
|
||||||
PendingIntent installPendingIntent = PendingIntent.getActivity(
|
PendingIntent installPendingIntent = PendingIntent.getActivity(
|
||||||
mContext.getApplicationContext(),
|
context.getApplicationContext(),
|
||||||
uri.hashCode(),
|
uri.hashCode(),
|
||||||
installIntent,
|
installIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
@ -81,11 +81,11 @@ public class ExtensionInstaller extends Installer {
|
|||||||
protected void uninstallPackage(String packageName) {
|
protected void uninstallPackage(String packageName) {
|
||||||
sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_STARTED);
|
sendBroadcastUninstall(packageName, Installer.ACTION_UNINSTALL_STARTED);
|
||||||
|
|
||||||
Intent uninstallIntent = new Intent(mContext, InstallExtensionDialogActivity.class);
|
Intent uninstallIntent = new Intent(context, InstallExtensionDialogActivity.class);
|
||||||
uninstallIntent.setAction(InstallExtensionDialogActivity.ACTION_UNINSTALL);
|
uninstallIntent.setAction(InstallExtensionDialogActivity.ACTION_UNINSTALL);
|
||||||
|
|
||||||
PendingIntent uninstallPendingIntent = PendingIntent.getActivity(
|
PendingIntent uninstallPendingIntent = PendingIntent.getActivity(
|
||||||
mContext.getApplicationContext(),
|
context.getApplicationContext(),
|
||||||
packageName.hashCode(),
|
packageName.hashCode(),
|
||||||
uninstallIntent,
|
uninstallIntent,
|
||||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
@ -340,8 +340,7 @@ public class InstallManagerService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getAppName(Apk apk) {
|
private String getAppName(Apk apk) {
|
||||||
App app = ACTIVE_APPS.get(apk.packageName);
|
return ACTIVE_APPS.get(apk.packageName).name;
|
||||||
return app.name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,9 +46,9 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public abstract class Installer {
|
public abstract class Installer {
|
||||||
final Context mContext;
|
final Context context;
|
||||||
final PackageManager mPm;
|
final PackageManager pm;
|
||||||
private LocalBroadcastManager localBroadcastManager;
|
final LocalBroadcastManager localBroadcastManager;
|
||||||
|
|
||||||
public static final String ACTION_INSTALL_STARTED = "org.fdroid.fdroid.installer.Installer.action.INSTALL_STARTED";
|
public static final String ACTION_INSTALL_STARTED = "org.fdroid.fdroid.installer.Installer.action.INSTALL_STARTED";
|
||||||
public static final String ACTION_INSTALL_COMPLETE = "org.fdroid.fdroid.installer.Installer.action.INSTALL_COMPLETE";
|
public static final String ACTION_INSTALL_COMPLETE = "org.fdroid.fdroid.installer.Installer.action.INSTALL_COMPLETE";
|
||||||
@ -83,8 +83,8 @@ public abstract class Installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Installer(Context context) {
|
Installer(Context context) {
|
||||||
this.mContext = context;
|
this.context = context;
|
||||||
this.mPm = context.getPackageManager();
|
this.pm = context.getPackageManager();
|
||||||
localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ public abstract class Installer {
|
|||||||
int count = newPermissionCount(apk);
|
int count = newPermissionCount(apk);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
Uri uri = ApkProvider.getContentUri(apk);
|
Uri uri = ApkProvider.getContentUri(apk);
|
||||||
Intent intent = new Intent(mContext, InstallConfirmActivity.class);
|
Intent intent = new Intent(context, InstallConfirmActivity.class);
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
@ -181,12 +181,12 @@ public abstract class Installer {
|
|||||||
// return 0;
|
// return 0;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
AppDiff appDiff = new AppDiff(mContext.getPackageManager(), apk);
|
AppDiff appDiff = new AppDiff(context.getPackageManager(), apk);
|
||||||
if (appDiff.mPkgInfo == null) {
|
if (appDiff.mPkgInfo == null) {
|
||||||
// could not get diff because we couldn't parse the package
|
// could not get diff because we couldn't parse the package
|
||||||
throw new RuntimeException("cannot parse!");
|
throw new RuntimeException("cannot parse!");
|
||||||
}
|
}
|
||||||
AppSecurityPermissions perms = new AppSecurityPermissions(mContext, appDiff.mPkgInfo);
|
AppSecurityPermissions perms = new AppSecurityPermissions(context, appDiff.mPkgInfo);
|
||||||
if (appDiff.mInstalledAppInfo != null) {
|
if (appDiff.mInstalledAppInfo != null) {
|
||||||
// update to an existing app
|
// update to an existing app
|
||||||
return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
|
return perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW);
|
||||||
@ -200,7 +200,7 @@ public abstract class Installer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(mContext, UninstallDialogActivity.class);
|
Intent intent = new Intent(context, UninstallDialogActivity.class);
|
||||||
intent.putExtra(Installer.EXTRA_PACKAGE_NAME, packageName);
|
intent.putExtra(Installer.EXTRA_PACKAGE_NAME, packageName);
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
|
@ -28,7 +28,6 @@ import android.os.IBinder;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
@ -44,8 +43,6 @@ public class InstallerService extends Service {
|
|||||||
|
|
||||||
private volatile Looper serviceLooper;
|
private volatile Looper serviceLooper;
|
||||||
private static volatile ServiceHandler serviceHandler;
|
private static volatile ServiceHandler serviceHandler;
|
||||||
private LocalBroadcastManager localBroadcastManager;
|
|
||||||
private Installer installer;
|
|
||||||
|
|
||||||
private final class ServiceHandler extends Handler {
|
private final class ServiceHandler extends Handler {
|
||||||
ServiceHandler(Looper looper) {
|
ServiceHandler(Looper looper) {
|
||||||
@ -70,7 +67,6 @@ public class InstallerService extends Service {
|
|||||||
|
|
||||||
serviceLooper = thread.getLooper();
|
serviceLooper = thread.getLooper();
|
||||||
serviceHandler = new ServiceHandler(serviceLooper);
|
serviceHandler = new ServiceHandler(serviceLooper);
|
||||||
localBroadcastManager = LocalBroadcastManager.getInstance(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -118,7 +114,7 @@ public class InstallerService extends Service {
|
|||||||
|
|
||||||
protected void handleIntent(Intent intent) {
|
protected void handleIntent(Intent intent) {
|
||||||
String packageName = intent.getStringExtra(Installer.EXTRA_PACKAGE_NAME);
|
String packageName = intent.getStringExtra(Installer.EXTRA_PACKAGE_NAME);
|
||||||
installer = InstallerFactory.create(this, packageName);
|
Installer installer = InstallerFactory.create(this, packageName);
|
||||||
|
|
||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
case ACTION_INSTALL: {
|
case ACTION_INSTALL: {
|
||||||
|
@ -326,7 +326,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
|
|
||||||
final Uri sanitizedUri;
|
final Uri sanitizedUri;
|
||||||
try {
|
try {
|
||||||
sanitizedUri = Installer.prepareApkFile(mContext, uri, packageName);
|
sanitizedUri = Installer.prepareApkFile(context, uri, packageName);
|
||||||
} catch (Installer.InstallFailedException e) {
|
} catch (Installer.InstallFailedException e) {
|
||||||
Log.e(TAG, "prepareApkFile failed", e);
|
Log.e(TAG, "prepareApkFile failed", e);
|
||||||
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
sendBroadcastInstall(uri, originatingUri, Installer.ACTION_INSTALL_INTERRUPTED,
|
||||||
@ -367,7 +367,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
|
|
||||||
Intent serviceIntent = new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
|
Intent serviceIntent = new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
|
||||||
serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
||||||
mContext.getApplicationContext().bindService(serviceIntent, mServiceConnection,
|
context.getApplicationContext().bindService(serviceIntent, mServiceConnection,
|
||||||
Context.BIND_AUTO_CREATE);
|
Context.BIND_AUTO_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +378,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
ApplicationInfo appInfo;
|
ApplicationInfo appInfo;
|
||||||
try {
|
try {
|
||||||
//noinspection WrongConstant (lint is actually wrong here!)
|
//noinspection WrongConstant (lint is actually wrong here!)
|
||||||
appInfo = mPm.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
appInfo = pm.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES);
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
} catch (PackageManager.NameNotFoundException e) {
|
||||||
Log.w(TAG, "Failed to get ApplicationInfo for uninstalling");
|
Log.w(TAG, "Failed to get ApplicationInfo for uninstalling");
|
||||||
return;
|
return;
|
||||||
@ -402,9 +402,9 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: move this to methods in activity/ Installer with activity context!
|
// TODO: move this to methods in activity/ Installer with activity context!
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(appInfo.loadLabel(mPm));
|
builder.setTitle(appInfo.loadLabel(pm));
|
||||||
builder.setIcon(appInfo.loadIcon(mPm));
|
builder.setIcon(appInfo.loadIcon(pm));
|
||||||
builder.setPositiveButton(android.R.string.ok,
|
builder.setPositiveButton(android.R.string.ok,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -463,7 +463,7 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
|
|
||||||
Intent serviceIntent = new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
|
Intent serviceIntent = new Intent(PRIVILEGED_EXTENSION_SERVICE_INTENT);
|
||||||
serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
serviceIntent.setPackage(PRIVILEGED_EXTENSION_PACKAGE_NAME);
|
||||||
mContext.getApplicationContext().bindService(serviceIntent, mServiceConnection,
|
context.getApplicationContext().bindService(serviceIntent, mServiceConnection,
|
||||||
Context.BIND_AUTO_CREATE);
|
Context.BIND_AUTO_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
|
|||||||
public static final String ACTION_POST_INSTALL = "post_install";
|
public static final String ACTION_POST_INSTALL = "post_install";
|
||||||
public static final String ACTION_FIRST_TIME = "first_time";
|
public static final String ACTION_FIRST_TIME = "first_time";
|
||||||
|
|
||||||
private String apkFile;
|
private String apkPath;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -74,7 +74,8 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apkFile = (new File(getIntent().getData().getPath())).getAbsolutePath();
|
File apkFile = new File(getIntent().getData().getPath());
|
||||||
|
apkPath = apkFile.getAbsolutePath();
|
||||||
|
|
||||||
switch (getIntent().getAction()) {
|
switch (getIntent().getAction()) {
|
||||||
case ACTION_UNINSTALL:
|
case ACTION_UNINSTALL:
|
||||||
@ -335,7 +336,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... voids) {
|
protected Void doInBackground(Void... voids) {
|
||||||
InstallExtension.create(getApplicationContext()).runInstall(apkFile);
|
InstallExtension.create(getApplicationContext()).runInstall(apkPath);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,6 @@ import android.content.DialogInterface;
|
|||||||
import android.content.DialogInterface.OnCancelListener;
|
import android.content.DialogInterface.OnCancelListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -60,17 +59,15 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
|
|
||||||
private Intent intent;
|
private Intent intent;
|
||||||
|
|
||||||
private PackageManager mPm;
|
private AppDiff appDiff;
|
||||||
|
|
||||||
private AppDiff mAppDiff;
|
|
||||||
|
|
||||||
// View for install progress
|
// View for install progress
|
||||||
private View mInstallConfirm;
|
private View installConfirm;
|
||||||
// Buttons to indicate user acceptance
|
// Buttons to indicate user acceptance
|
||||||
private Button mOk;
|
private Button okButton;
|
||||||
private Button mCancel;
|
private Button cancelButton;
|
||||||
private CaffeinatedScrollView mScrollView;
|
private CaffeinatedScrollView scrollView;
|
||||||
private boolean mOkCanInstall;
|
private boolean okCanInstall;
|
||||||
|
|
||||||
private static final String TAB_ID_ALL = "all";
|
private static final String TAB_ID_ALL = "all";
|
||||||
private static final String TAB_ID_NEW = "new";
|
private static final String TAB_ID_NEW = "new";
|
||||||
@ -106,27 +103,27 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
});
|
});
|
||||||
|
|
||||||
boolean permVisible = false;
|
boolean permVisible = false;
|
||||||
mScrollView = null;
|
scrollView = null;
|
||||||
mOkCanInstall = false;
|
okCanInstall = false;
|
||||||
int msg = 0;
|
int msg = 0;
|
||||||
AppSecurityPermissions perms = new AppSecurityPermissions(this, mAppDiff.mPkgInfo);
|
AppSecurityPermissions perms = new AppSecurityPermissions(this, appDiff.mPkgInfo);
|
||||||
if (mAppDiff.mInstalledAppInfo != null) {
|
if (appDiff.mInstalledAppInfo != null) {
|
||||||
msg = (mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
msg = (appDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
||||||
? R.string.install_confirm_update_system
|
? R.string.install_confirm_update_system
|
||||||
: R.string.install_confirm_update;
|
: R.string.install_confirm_update;
|
||||||
mScrollView = new CaffeinatedScrollView(this);
|
scrollView = new CaffeinatedScrollView(this);
|
||||||
mScrollView.setFillViewport(true);
|
scrollView.setFillViewport(true);
|
||||||
final boolean newPermissionsFound =
|
final boolean newPermissionsFound =
|
||||||
perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0;
|
perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0;
|
||||||
if (newPermissionsFound) {
|
if (newPermissionsFound) {
|
||||||
permVisible = true;
|
permVisible = true;
|
||||||
mScrollView.addView(perms.getPermissionsView(
|
scrollView.addView(perms.getPermissionsView(
|
||||||
AppSecurityPermissions.WHICH_NEW));
|
AppSecurityPermissions.WHICH_NEW));
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("This should not happen. No new permissions were found but InstallConfirmActivity has been started!");
|
throw new RuntimeException("This should not happen. No new permissions were found but InstallConfirmActivity has been started!");
|
||||||
}
|
}
|
||||||
adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(
|
adapter.addTab(tabHost.newTabSpec(TAB_ID_NEW).setIndicator(
|
||||||
getText(R.string.newPerms)), mScrollView);
|
getText(R.string.newPerms)), scrollView);
|
||||||
} else {
|
} else {
|
||||||
findViewById(R.id.tabscontainer).setVisibility(View.GONE);
|
findViewById(R.id.tabscontainer).setVisibility(View.GONE);
|
||||||
findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||||
@ -137,8 +134,8 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
LayoutInflater inflater = (LayoutInflater) getSystemService(
|
LayoutInflater inflater = (LayoutInflater) getSystemService(
|
||||||
Context.LAYOUT_INFLATER_SERVICE);
|
Context.LAYOUT_INFLATER_SERVICE);
|
||||||
View root = inflater.inflate(R.layout.permissions_list, null);
|
View root = inflater.inflate(R.layout.permissions_list, null);
|
||||||
if (mScrollView == null) {
|
if (scrollView == null) {
|
||||||
mScrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview);
|
scrollView = (CaffeinatedScrollView) root.findViewById(R.id.scrollview);
|
||||||
}
|
}
|
||||||
final ViewGroup permList = (ViewGroup) root.findViewById(R.id.permission_list);
|
final ViewGroup permList = (ViewGroup) root.findViewById(R.id.permission_list);
|
||||||
permList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
|
permList.addView(perms.getPermissionsView(AppSecurityPermissions.WHICH_ALL));
|
||||||
@ -147,10 +144,10 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!permVisible) {
|
if (!permVisible) {
|
||||||
if (mAppDiff.mInstalledAppInfo != null) {
|
if (appDiff.mInstalledAppInfo != null) {
|
||||||
// This is an update to an application, but there are no
|
// This is an update to an application, but there are no
|
||||||
// permissions at all.
|
// permissions at all.
|
||||||
msg = (mAppDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
msg = (appDiff.mInstalledAppInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0
|
||||||
? R.string.install_confirm_update_system_no_perms
|
? R.string.install_confirm_update_system_no_perms
|
||||||
: R.string.install_confirm_update_no_perms;
|
: R.string.install_confirm_update_no_perms;
|
||||||
} else {
|
} else {
|
||||||
@ -160,27 +157,27 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
tabHost.setVisibility(View.GONE);
|
tabHost.setVisibility(View.GONE);
|
||||||
findViewById(R.id.filler).setVisibility(View.VISIBLE);
|
findViewById(R.id.filler).setVisibility(View.VISIBLE);
|
||||||
findViewById(R.id.divider).setVisibility(View.GONE);
|
findViewById(R.id.divider).setVisibility(View.GONE);
|
||||||
mScrollView = null;
|
scrollView = null;
|
||||||
}
|
}
|
||||||
if (msg != 0) {
|
if (msg != 0) {
|
||||||
((TextView) findViewById(R.id.install_confirm)).setText(msg);
|
((TextView) findViewById(R.id.install_confirm)).setText(msg);
|
||||||
}
|
}
|
||||||
mInstallConfirm.setVisibility(View.VISIBLE);
|
installConfirm.setVisibility(View.VISIBLE);
|
||||||
mOk = (Button) findViewById(R.id.ok_button);
|
okButton = (Button) findViewById(R.id.ok_button);
|
||||||
mCancel = (Button) findViewById(R.id.cancel_button);
|
cancelButton = (Button) findViewById(R.id.cancel_button);
|
||||||
mOk.setOnClickListener(this);
|
okButton.setOnClickListener(this);
|
||||||
mCancel.setOnClickListener(this);
|
cancelButton.setOnClickListener(this);
|
||||||
if (mScrollView == null) {
|
if (scrollView == null) {
|
||||||
// There is nothing to scroll view, so the ok button is immediately
|
// There is nothing to scroll view, so the ok button is immediately
|
||||||
// set to install.
|
// set to install.
|
||||||
mOk.setText(R.string.menu_install);
|
okButton.setText(R.string.menu_install);
|
||||||
mOkCanInstall = true;
|
okCanInstall = true;
|
||||||
} else {
|
} else {
|
||||||
mScrollView.setFullScrollAction(new Runnable() {
|
scrollView.setFullScrollAction(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mOk.setText(R.string.menu_install);
|
okButton.setText(R.string.menu_install);
|
||||||
mOkCanInstall = true;
|
okCanInstall = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -192,15 +189,13 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
|
|
||||||
((FDroidApp) getApplication()).applyDialogTheme(this);
|
((FDroidApp) getApplication()).applyDialogTheme(this);
|
||||||
|
|
||||||
mPm = getPackageManager();
|
|
||||||
|
|
||||||
intent = getIntent();
|
intent = getIntent();
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
Apk apk = ApkProvider.Helper.find(this, uri, ApkProvider.DataColumns.ALL);
|
Apk apk = ApkProvider.Helper.find(this, uri, ApkProvider.DataColumns.ALL);
|
||||||
mApp = AppProvider.Helper.findByPackageName(getContentResolver(), apk.packageName);
|
mApp = AppProvider.Helper.findByPackageName(getContentResolver(), apk.packageName);
|
||||||
|
|
||||||
mAppDiff = new AppDiff(mPm, apk);
|
appDiff = new AppDiff(getPackageManager(), apk);
|
||||||
if (mAppDiff.mPkgInfo == null) {
|
if (appDiff.mPkgInfo == null) {
|
||||||
setResult(RESULT_CANNOT_PARSE, intent);
|
setResult(RESULT_CANNOT_PARSE, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@ -212,8 +207,8 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
|
getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
|
||||||
mInstallConfirm = findViewById(R.id.install_confirm_panel);
|
installConfirm = findViewById(R.id.install_confirm_panel);
|
||||||
mInstallConfirm.setVisibility(View.INVISIBLE);
|
installConfirm.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
startInstallConfirm();
|
startInstallConfirm();
|
||||||
}
|
}
|
||||||
@ -224,14 +219,14 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (v == mOk) {
|
if (v == okButton) {
|
||||||
if (mOkCanInstall || mScrollView == null) {
|
if (okCanInstall || scrollView == null) {
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
mScrollView.pageScroll(View.FOCUS_DOWN);
|
scrollView.pageScroll(View.FOCUS_DOWN);
|
||||||
}
|
}
|
||||||
} else if (v == mCancel) {
|
} else if (v == cancelButton) {
|
||||||
setResult(RESULT_CANCELED, intent);
|
setResult(RESULT_CANCELED, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ import org.fdroid.fdroid.NfcHelper;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.R;
|
import org.fdroid.fdroid.R;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
import org.fdroid.fdroid.compat.PackageManagerCompat;
|
|
||||||
import org.fdroid.fdroid.data.Apk;
|
import org.fdroid.fdroid.data.Apk;
|
||||||
import org.fdroid.fdroid.data.ApkProvider;
|
import org.fdroid.fdroid.data.ApkProvider;
|
||||||
import org.fdroid.fdroid.data.App;
|
import org.fdroid.fdroid.data.App;
|
||||||
@ -122,7 +121,6 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
private PrepareSwapRepo updateSwappableAppsTask;
|
private PrepareSwapRepo updateSwappableAppsTask;
|
||||||
private NewRepoConfig confirmSwapConfig;
|
private NewRepoConfig confirmSwapConfig;
|
||||||
private LocalBroadcastManager localBroadcastManager;
|
private LocalBroadcastManager localBroadcastManager;
|
||||||
private BroadcastReceiver downloadCompleteReceiver;
|
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final ServiceConnection serviceConnection = new ServiceConnection() {
|
private final ServiceConnection serviceConnection = new ServiceConnection() {
|
||||||
@ -776,7 +774,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
|
|||||||
public void install(@NonNull final App app) {
|
public void install(@NonNull final App app) {
|
||||||
final Apk apk = ApkProvider.Helper.find(this, app.packageName, app.suggestedVersionCode);
|
final Apk apk = ApkProvider.Helper.find(this, app.packageName, app.suggestedVersionCode);
|
||||||
String urlString = apk.getUrl();
|
String urlString = apk.getUrl();
|
||||||
downloadCompleteReceiver = new BroadcastReceiver() {
|
BroadcastReceiver downloadCompleteReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String path = intent.getStringExtra(Downloader.EXTRA_DOWNLOAD_PATH);
|
String path = intent.getStringExtra(Downloader.EXTRA_DOWNLOAD_PATH);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user