use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.
the class PrintPreviewController method onContentUpdated.
public void onContentUpdated(boolean documentChanged, int documentPageCount, PageRange[] writtenPages, PageRange[] selectedPages, MediaSize mediaSize, Margins minMargins) {
boolean contentChanged = false;
if (documentChanged) {
contentChanged = true;
}
if (documentPageCount != mDocumentPageCount) {
mDocumentPageCount = documentPageCount;
contentChanged = true;
}
if (contentChanged) {
// If not closed, close as we start over.
if (mPageAdapter.isOpened()) {
Message operation = mHandler.obtainMessage(MyHandler.MSG_CLOSE);
mHandler.enqueueOperation(operation);
}
}
// all rendered pages and reopen the file...
if ((contentChanged || !mPageAdapter.isOpened()) && writtenPages != null) {
Message operation = mHandler.obtainMessage(MyHandler.MSG_OPEN);
mHandler.enqueueOperation(operation);
}
// Update the attributes before after closed to avoid flicker.
SomeArgs args = SomeArgs.obtain();
args.arg1 = writtenPages;
args.arg2 = selectedPages;
args.arg3 = mediaSize;
args.arg4 = minMargins;
args.argi1 = documentPageCount;
Message operation = mHandler.obtainMessage(MyHandler.MSG_UPDATE, args);
mHandler.enqueueOperation(operation);
// If document changed and has pages we want to start preloading.
if (contentChanged && writtenPages != null) {
operation = mHandler.obtainMessage(MyHandler.MSG_START_PRELOAD);
mHandler.enqueueOperation(operation);
}
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.
the class AppWidgetServiceImpl method scheduleNotifyUpdateAppWidgetLocked.
private void scheduleNotifyUpdateAppWidgetLocked(Widget widget, RemoteViews updateViews) {
long requestId = REQUEST_COUNTER.incrementAndGet();
if (widget != null) {
widget.updateRequestIds.put(ID_VIEWS_UPDATE, requestId);
}
if (widget == null || widget.provider == null || widget.provider.zombie || widget.host.callbacks == null || widget.host.zombie) {
return;
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = widget.host;
args.arg2 = widget.host.callbacks;
args.arg3 = (updateViews != null) ? updateViews.clone() : null;
args.arg4 = requestId;
args.argi1 = widget.appWidgetId;
mCallbackHandler.obtainMessage(CallbackHandler.MSG_NOTIFY_UPDATE_APP_WIDGET, args).sendToTarget();
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.
the class AppWidgetServiceImpl method scheduleNotifyAppWidgetViewDataChanged.
private void scheduleNotifyAppWidgetViewDataChanged(Widget widget, int viewId) {
if (viewId == ID_VIEWS_UPDATE || viewId == ID_PROVIDER_CHANGED) {
// method with a wrong id. In that case, ignore the call.
return;
}
long requestId = REQUEST_COUNTER.incrementAndGet();
if (widget != null) {
widget.updateRequestIds.put(viewId, requestId);
}
if (widget == null || widget.host == null || widget.host.zombie || widget.host.callbacks == null || widget.provider == null || widget.provider.zombie) {
return;
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = widget.host;
args.arg2 = widget.host.callbacks;
args.arg3 = requestId;
args.argi1 = widget.appWidgetId;
args.argi2 = viewId;
mCallbackHandler.obtainMessage(CallbackHandler.MSG_NOTIFY_VIEW_DATA_CHANGED, args).sendToTarget();
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.
the class InputManagerService method setKeyboardLayoutForInputDeviceInner.
private void setKeyboardLayoutForInputDeviceInner(InputDeviceIdentifier identifier, InputMethodSubtypeHandle imeHandle, String keyboardLayoutDescriptor) {
String key = getLayoutDescriptor(identifier);
synchronized (mDataStore) {
try {
if (mDataStore.setKeyboardLayout(key, imeHandle, keyboardLayoutDescriptor)) {
if (DEBUG) {
Slog.d(TAG, "Set keyboard layout " + keyboardLayoutDescriptor + " for subtype " + imeHandle + " and device " + identifier + " using key " + key);
}
if (imeHandle.equals(mCurrentImeHandle)) {
if (DEBUG) {
Slog.d(TAG, "Layout for current subtype changed, switching layout");
}
SomeArgs args = SomeArgs.obtain();
args.arg1 = identifier;
args.arg2 = imeHandle;
mHandler.obtainMessage(MSG_SWITCH_KEYBOARD_LAYOUT, args).sendToTarget();
}
mHandler.sendEmptyMessage(MSG_RELOAD_KEYBOARD_LAYOUTS);
}
} finally {
mDataStore.saveIfNeeded();
}
}
}
use of com.android.internal.os.SomeArgs in project android_frameworks_base by crdroidandroid.
the class InputManagerService method notifySwitch.
// Native callback.
private void notifySwitch(long whenNanos, int switchValues, int switchMask) {
if (DEBUG) {
Slog.d(TAG, "notifySwitch: values=" + Integer.toHexString(switchValues) + ", mask=" + Integer.toHexString(switchMask));
}
if ((switchMask & SW_LID_BIT) != 0) {
final boolean lidOpen = ((switchValues & SW_LID_BIT) == 0);
mWindowManagerCallbacks.notifyLidSwitchChanged(whenNanos, lidOpen);
}
if ((switchMask & SW_CAMERA_LENS_COVER_BIT) != 0) {
final boolean lensCovered = ((switchValues & SW_CAMERA_LENS_COVER_BIT) != 0);
mWindowManagerCallbacks.notifyCameraLensCoverSwitchChanged(whenNanos, lensCovered);
}
if (mUseDevInputEventForAudioJack && (switchMask & SW_JACK_BITS) != 0) {
mWiredAccessoryCallbacks.notifyWiredAccessoryChanged(whenNanos, switchValues, switchMask);
}
if ((switchMask & SW_TABLET_MODE_BIT) != 0) {
SomeArgs args = SomeArgs.obtain();
args.argi1 = (int) (whenNanos & 0xFFFFFFFF);
args.argi2 = (int) (whenNanos >> 32);
args.arg1 = Boolean.valueOf((switchValues & SW_TABLET_MODE_BIT) != 0);
mHandler.obtainMessage(MSG_DELIVER_TABLET_MODE_CHANGED, args).sendToTarget();
}
}
Aggregations