Code/doc cleanup
This commit is contained in:
parent
6710e9a4b9
commit
aeae0bcec3
@ -96,7 +96,7 @@ public class AppDetails extends ListActivity {
|
||||
TextView nativecode;
|
||||
}
|
||||
|
||||
// observer to update view when package has been installed/removed
|
||||
// observer to update view when package has been installed/deleted
|
||||
AppObserver myAppObserver;
|
||||
class AppObserver extends ContentObserver {
|
||||
public AppObserver(Handler handler) {
|
||||
|
@ -31,7 +31,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.net.Uri;
|
||||
|
||||
/**
|
||||
* For Android < 4 Default Installer using the public PackageManager API of
|
||||
* For Android < 4: Default Installer using the public PackageManager API of
|
||||
* Android to install/delete packages. This starts a Activity from the Android
|
||||
* OS showing all permissions/changed permissions. The the user needs to
|
||||
* manually press an install button, this Installer cannot be used for
|
||||
|
@ -33,7 +33,7 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
/**
|
||||
* For Android >= 4.0 Default Installer using the public PackageManager API of
|
||||
* For Android >= 4.0: Default Installer using the public PackageManager API of
|
||||
* Android to install/delete packages. This starts a Activity from the Android
|
||||
* OS showing all permissions/changed permissions. The the user needs to
|
||||
* manually press an install button, this Installer cannot be used for
|
||||
@ -95,11 +95,6 @@ public class DefaultInstallerSdk14 extends Installer {
|
||||
|
||||
@Override
|
||||
public boolean handleOnActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
/**
|
||||
* resultCode is always 0 on Android < 4.0. See
|
||||
* com.android.packageinstaller.PackageInstallerActivity: setResult is
|
||||
* never executed!
|
||||
*/
|
||||
switch (requestCode) {
|
||||
case REQUEST_CODE_INSTALL:
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
|
@ -75,7 +75,8 @@ public class RootInstaller extends Installer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installPackageInternal(final List<File> apkFiles) throws AndroidNotCompatibleException {
|
||||
public void installPackageInternal(final List<File> apkFiles)
|
||||
throws AndroidNotCompatibleException {
|
||||
rootSession = createShellBuilder().open(new Shell.OnCommandResultListener() {
|
||||
|
||||
// Callback to report whether the shell was successfully
|
||||
@ -98,7 +99,8 @@ public class RootInstaller extends Installer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePackageInternal(final String packageName) throws AndroidNotCompatibleException {
|
||||
public void deletePackageInternal(final String packageName)
|
||||
throws AndroidNotCompatibleException {
|
||||
rootSession = createShellBuilder().open(new Shell.OnCommandResultListener() {
|
||||
|
||||
// Callback to report whether the shell was successfully
|
||||
@ -127,6 +129,24 @@ public class RootInstaller extends Installer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addInstallCommand(File apkFile) {
|
||||
rootSession.addCommand("pm install -r " + apkFile.getAbsolutePath(), 0,
|
||||
new Shell.OnCommandResultListener() {
|
||||
public void onCommandResult(int commandCode, int exitCode, List<String> output) {
|
||||
// close su shell
|
||||
rootSession.close();
|
||||
|
||||
if (exitCode < 0) {
|
||||
Log.e(TAG, "Install failed with exit code " + exitCode);
|
||||
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
|
||||
InstallerCallback.ERROR_CODE_OTHER);
|
||||
} else {
|
||||
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addInstallCommand(List<File> apkFiles) {
|
||||
ArrayList<String> commands = new ArrayList<String>();
|
||||
String pm = "pm install -r ";
|
||||
@ -153,24 +173,6 @@ public class RootInstaller extends Installer {
|
||||
|
||||
}
|
||||
|
||||
private void addInstallCommand(File apkFile) {
|
||||
rootSession.addCommand("pm install -r " + apkFile.getAbsolutePath(), 0,
|
||||
new Shell.OnCommandResultListener() {
|
||||
public void onCommandResult(int commandCode, int exitCode, List<String> output) {
|
||||
// close su shell
|
||||
rootSession.close();
|
||||
|
||||
if (exitCode < 0) {
|
||||
Log.e(TAG, "Install failed with exit code " + exitCode);
|
||||
mCallback.onError(InstallerCallback.OPERATION_INSTALL,
|
||||
InstallerCallback.ERROR_CODE_OTHER);
|
||||
} else {
|
||||
mCallback.onSuccess(InstallerCallback.OPERATION_INSTALL);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addDeleteCommand(String packageName) {
|
||||
rootSession.addCommand("pm uninstall " + packageName, 0,
|
||||
new Shell.OnCommandResultListener() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user