reduce visibility of installer extra constants
This should encourage devs to stick with the nice static methods that are the "public" API.
This commit is contained in:
parent
f949c5807f
commit
738a92f5d2
@ -38,10 +38,10 @@ import org.fdroid.fdroid.R;
|
|||||||
public class DefaultInstallerActivity extends FragmentActivity {
|
public class DefaultInstallerActivity extends FragmentActivity {
|
||||||
public static final String TAG = "AndroidInstallerAct";
|
public static final String TAG = "AndroidInstallerAct";
|
||||||
|
|
||||||
public static final String ACTION_INSTALL_PACKAGE = "org.fdroid.fdroid.INSTALL_PACKAGE";
|
static final String ACTION_INSTALL_PACKAGE = "org.fdroid.fdroid.installer.DefaultInstaller.action.INSTALL_PACKAGE";
|
||||||
public static final String ACTION_UNINSTALL_PACKAGE = "org.fdroid.fdroid.UNINSTALL_PACKAGE";
|
static final String ACTION_UNINSTALL_PACKAGE = "org.fdroid.fdroid.installer.DefaultInstaller.action.UNINSTALL_PACKAGE";
|
||||||
|
|
||||||
public static final String EXTRA_UNINSTALL_PACKAGE_NAME = "uninstallPackageName";
|
static final String EXTRA_UNINSTALL_PACKAGE_NAME = "org.fdroid.fdroid.installer.DefaultInstaller.extra.UNINSTALL_PACKAGE_NAME";
|
||||||
|
|
||||||
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;
|
||||||
|
@ -95,7 +95,7 @@ public abstract class Installer {
|
|||||||
localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
localBroadcastManager = LocalBroadcastManager.getInstance(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Uri prepareApkFile(Context context, Uri uri, String packageName)
|
static Uri prepareApkFile(Context context, Uri uri, String packageName)
|
||||||
throws InstallFailedException {
|
throws InstallFailedException {
|
||||||
|
|
||||||
File apkFile = new File(uri.getPath());
|
File apkFile = new File(uri.getPath());
|
||||||
@ -233,7 +233,7 @@ public abstract class Installer {
|
|||||||
/**
|
/**
|
||||||
* Checks the APK file against the provided hash, returning whether it is a match.
|
* Checks the APK file against the provided hash, returning whether it is a match.
|
||||||
*/
|
*/
|
||||||
public static boolean verifyApkFile(File apkFile, String hash, String hashType)
|
static boolean verifyApkFile(File apkFile, String hash, String hashType)
|
||||||
throws NoSuchAlgorithmException {
|
throws NoSuchAlgorithmException {
|
||||||
if (!apkFile.exists()) {
|
if (!apkFile.exists()) {
|
||||||
return false;
|
return false;
|
||||||
@ -242,20 +242,20 @@ public abstract class Installer {
|
|||||||
return hasher.match(hash);
|
return hasher.match(hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastInstall(Uri downloadUri, String action,
|
void sendBroadcastInstall(Uri downloadUri, String action,
|
||||||
PendingIntent pendingIntent) {
|
PendingIntent pendingIntent) {
|
||||||
sendBroadcastInstall(downloadUri, action, pendingIntent, null);
|
sendBroadcastInstall(downloadUri, action, pendingIntent, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastInstall(Uri downloadUri, String action) {
|
void sendBroadcastInstall(Uri downloadUri, String action) {
|
||||||
sendBroadcastInstall(downloadUri, action, null, null);
|
sendBroadcastInstall(downloadUri, action, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastInstall(Uri downloadUri, String action, String errorMessage) {
|
void sendBroadcastInstall(Uri downloadUri, String action, String errorMessage) {
|
||||||
sendBroadcastInstall(downloadUri, action, null, errorMessage);
|
sendBroadcastInstall(downloadUri, action, null, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastInstall(Uri downloadUri, String action,
|
void sendBroadcastInstall(Uri downloadUri, String action,
|
||||||
PendingIntent pendingIntent, String errorMessage) {
|
PendingIntent pendingIntent, String errorMessage) {
|
||||||
Intent intent = new Intent(action);
|
Intent intent = new Intent(action);
|
||||||
intent.setData(downloadUri);
|
intent.setData(downloadUri);
|
||||||
@ -266,20 +266,20 @@ public abstract class Installer {
|
|||||||
localBroadcastManager.sendBroadcast(intent);
|
localBroadcastManager.sendBroadcast(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastUninstall(String packageName, String action, String errorMessage) {
|
void sendBroadcastUninstall(String packageName, String action, String errorMessage) {
|
||||||
sendBroadcastUninstall(packageName, action, null, errorMessage);
|
sendBroadcastUninstall(packageName, action, null, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastUninstall(String packageName, String action) {
|
void sendBroadcastUninstall(String packageName, String action) {
|
||||||
sendBroadcastUninstall(packageName, action, null, null);
|
sendBroadcastUninstall(packageName, action, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastUninstall(String packageName, String action,
|
void sendBroadcastUninstall(String packageName, String action,
|
||||||
PendingIntent pendingIntent) {
|
PendingIntent pendingIntent) {
|
||||||
sendBroadcastUninstall(packageName, action, pendingIntent, null);
|
sendBroadcastUninstall(packageName, action, pendingIntent, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendBroadcastUninstall(String packageName, String action,
|
void sendBroadcastUninstall(String packageName, String action,
|
||||||
PendingIntent pendingIntent, String errorMessage) {
|
PendingIntent pendingIntent, String errorMessage) {
|
||||||
Uri uri = Uri.fromParts("package", packageName, null);
|
Uri uri = Uri.fromParts("package", packageName, null);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user