Java Code Examples for android.content.pm.IPackageInstallObserver2

The following are top voted examples for showing how to use android.content.pm.IPackageInstallObserver2. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: VirtualHook   File: PackageInstallerSession.java   View source code 6 votes vote down vote up
@Override
public boolean handleMessage(Message msg) {
    synchronized (mLock) {
        if (msg.obj != null) {
            mRemoteObserver = (IPackageInstallObserver2) msg.obj;
        }
        try {
            commitLocked();
        } catch (PackageManagerException e) {
            final String completeMsg = getCompleteMessage(e);
            VLog.e(TAG, "Commit of session " + sessionId + " failed: " + completeMsg);
            destroyInternal();
            dispatchSessionFinished(e.error, completeMsg, null);
        }

        return true;
    }
}
 
Example 2
Project: TPlayer   File: PackageInstallerSession.java   View source code 6 votes vote down vote up
@Override
public boolean handleMessage(Message msg) {
    synchronized (mLock) {
        if (msg.obj != null) {
            mRemoteObserver = (IPackageInstallObserver2) msg.obj;
        }
        try {
            commitLocked();
        } catch (PackageManagerException e) {
            final String completeMsg = getCompleteMessage(e);
            VLog.e(TAG, "Commit of session " + sessionId + " failed: " + completeMsg);
            destroyInternal();
            dispatchSessionFinished(e.error, completeMsg, null);
        }

        return true;
    }
}
 
Example 3
Project: container   File: PackageInstallerSession.java   View source code 6 votes vote down vote up
@Override
public boolean handleMessage(Message msg) {
    synchronized (mLock) {
        if (msg.obj != null) {
            mRemoteObserver = (IPackageInstallObserver2) msg.obj;
        }
        try {
            commitLocked();
        } catch (PackageManagerException e) {
            final String completeMsg = getCompleteMessage(e);
            VLog.e(TAG, "Commit of session " + sessionId + " failed: " + completeMsg);
            destroyInternal();
            dispatchSessionFinished(e.error, completeMsg, null);
        }

        return true;
    }
}
 
Example 4
Project: VirtualHook   File: PackageInstallerSession.java   View source code 5 votes vote down vote up
private void commitLocked() throws PackageManagerException {
    if (mDestroyed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session destroyed");
    }
    if (!mSealed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session not sealed");
    }
    try {
        resolveStageDir();
    } catch (IOException e) {
        e.printStackTrace();
    }
    validateInstallLocked();
    mInternalProgress = 0.5f;
    computeProgressLocked(true);
    // We've reached point of no return; call into PMS to install the stage.
    // Regardless of success or failure we always destroy session.
    final IPackageInstallObserver2 localObserver = new IPackageInstallObserver2.Stub() {
        @Override
        public void onUserActionRequired(Intent intent) {
            throw new IllegalStateException();
        }

        @Override
        public void onPackageInstalled(String basePackageName, int returnCode, String msg,
                                       Bundle extras) {
            destroyInternal();
            dispatchSessionFinished(returnCode, msg, extras);
        }
    };
}
 
Example 5
Project: TPlayer   File: PackageInstallerSession.java   View source code 5 votes vote down vote up
private void commitLocked() throws PackageManagerException {
    if (mDestroyed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session destroyed");
    }
    if (!mSealed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session not sealed");
    }
    try {
        resolveStageDir();
    } catch (IOException e) {
        e.printStackTrace();
    }
    validateInstallLocked();
    mInternalProgress = 0.5f;
    computeProgressLocked(true);
    // We've reached point of no return; call into PMS to install the stage.
    // Regardless of success or failure we always destroy session.
    final IPackageInstallObserver2 localObserver = new IPackageInstallObserver2.Stub() {
        @Override
        public void onUserActionRequired(Intent intent) {
            throw new IllegalStateException();
        }

        @Override
        public void onPackageInstalled(String basePackageName, int returnCode, String msg,
                                       Bundle extras) {
            destroyInternal();
            dispatchSessionFinished(returnCode, msg, extras);
        }
    };
}
 
Example 6
Project: container   File: PackageInstallerSession.java   View source code 5 votes vote down vote up
private void commitLocked() throws PackageManagerException {
    if (mDestroyed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session destroyed");
    }
    if (!mSealed) {
        throw new PackageManagerException(INSTALL_FAILED_INTERNAL_ERROR, "Session not sealed");
    }
    try {
        resolveStageDir();
    } catch (IOException e) {
        e.printStackTrace();
    }
    validateInstallLocked();
    mInternalProgress = 0.5f;
    computeProgressLocked(true);
    // We've reached point of no return; call into PMS to install the stage.
    // Regardless of success or failure we always destroy session.
    final IPackageInstallObserver2 localObserver = new IPackageInstallObserver2.Stub() {
        @Override
        public void onUserActionRequired(Intent intent) {
            throw new IllegalStateException();
        }

        @Override
        public void onPackageInstalled(String basePackageName, int returnCode, String msg,
                                       Bundle extras) {
            destroyInternal();
            dispatchSessionFinished(returnCode, msg, extras);
        }
    };
}
 
Example 7
Project: VirtualHook   File: PackageInstallObserver.java   View source code 4 votes vote down vote up
/**
 * {@hide}
 */
public IPackageInstallObserver2 getBinder() {
    return mBinder;
}
 
Example 8
Project: TPlayer   File: PackageInstallObserver.java   View source code 4 votes vote down vote up
/**
 * {@hide}
 */
public IPackageInstallObserver2 getBinder() {
    return mBinder;
}
 
Example 9
Project: container   File: PackageInstallObserver.java   View source code 4 votes vote down vote up
/**
 * {@hide}
 */
public IPackageInstallObserver2 getBinder() {
    return mBinder;
}