use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class SyncManager method sendSyncFinishedOrCanceledMessage.
private void sendSyncFinishedOrCanceledMessage(ActiveSyncContext syncContext, SyncResult syncResult) {
if (Log.isLoggable(TAG, Log.VERBOSE))
Log.v(TAG, "sending MESSAGE_SYNC_FINISHED");
Message msg = mSyncHandler.obtainMessage();
msg.what = SyncHandler.MESSAGE_SYNC_FINISHED;
msg.obj = new SyncHandlerMessagePayload(syncContext, syncResult);
mSyncHandler.sendMessage(msg);
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class SyncManager method sendCancelSyncsMessage.
private void sendCancelSyncsMessage(final Account account, final int userId, final String authority) {
if (Log.isLoggable(TAG, Log.VERBOSE))
Log.v(TAG, "sending MESSAGE_CANCEL");
Message msg = mSyncHandler.obtainMessage();
msg.what = SyncHandler.MESSAGE_CANCEL;
msg.obj = Pair.create(account, authority);
msg.arg1 = userId;
mSyncHandler.sendMessage(msg);
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method updateExternalMediaStatus.
/*
* Update media status on PackageManager.
*/
public void updateExternalMediaStatus(final boolean mediaStatus, final boolean reportStatus) {
int callingUid = Binder.getCallingUid();
if (callingUid != 0 && callingUid != Process.SYSTEM_UID) {
throw new SecurityException("Media status can only be updated by the system");
}
// be a different lock in that case.
synchronized (mPackages) {
Log.i(TAG, "Updating external media status from " + (mMediaMounted ? "mounted" : "unmounted") + " to " + (mediaStatus ? "mounted" : "unmounted"));
if (DEBUG_SD_INSTALL)
Log.i(TAG, "updateExternalMediaStatus:: mediaStatus=" + mediaStatus + ", mMediaMounted=" + mMediaMounted);
if (mediaStatus == mMediaMounted) {
final Message msg = mHandler.obtainMessage(UPDATED_MEDIA_STATUS, reportStatus ? 1 : 0, -1);
mHandler.sendMessage(msg);
return;
}
mMediaMounted = mediaStatus;
}
// Queue up an async operation since the package installation may take a
// little while.
mHandler.post(new Runnable() {
public void run() {
updateExternalMediaStatusInner(mediaStatus, reportStatus, true);
}
});
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method installPackageWithVerificationAndEncryption.
public void installPackageWithVerificationAndEncryption(Uri packageURI, IPackageInstallObserver observer, int flags, String installerPackageName, VerificationParams verificationParams, ContainerEncryptionParams encryptionParams) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.INSTALL_PACKAGES, null);
final int uid = Binder.getCallingUid();
if (isUserRestricted(UserHandle.getUserId(uid), UserManager.DISALLOW_INSTALL_APPS)) {
try {
observer.packageInstalled("", PackageManager.INSTALL_FAILED_USER_RESTRICTED);
} catch (RemoteException re) {
}
return;
}
UserHandle user;
if ((flags & PackageManager.INSTALL_ALL_USERS) != 0) {
user = UserHandle.ALL;
} else {
user = new UserHandle(UserHandle.getUserId(uid));
}
final int filteredFlags;
if (uid == Process.SHELL_UID || uid == 0) {
if (DEBUG_INSTALL) {
Slog.v(TAG, "Install from ADB");
}
filteredFlags = flags | PackageManager.INSTALL_FROM_ADB;
} else {
filteredFlags = flags & ~PackageManager.INSTALL_FROM_ADB;
}
verificationParams.setInstallerUid(uid);
final Message msg = mHandler.obtainMessage(INIT_COPY);
msg.obj = new InstallParams(packageURI, observer, filteredFlags, installerPackageName, verificationParams, encryptionParams, user);
mHandler.sendMessage(msg);
}
use of android.os.Message in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method getPackageSizeInfo.
public void getPackageSizeInfo(final String packageName, int userHandle, final IPackageStatsObserver observer) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.GET_PACKAGE_SIZE, null);
PackageStats stats = new PackageStats(packageName, userHandle);
/*
* Queue up an async operation since the package measurement may take a
* little while.
*/
Message msg = mHandler.obtainMessage(INIT_COPY);
msg.obj = new MeasureParams(stats, observer);
mHandler.sendMessage(msg);
}
Aggregations