use of android.os.IRemoteCallback in project cornerstone by Onskreen.
the class WindowManagerService method dumpWindowsNoHeaderLocked.
void dumpWindowsNoHeaderLocked(PrintWriter pw, boolean dumpAll, ArrayList<WindowState> windows) {
for (int i = mWindows.size() - 1; i >= 0; i--) {
WindowState w = mWindows.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" Window #");
pw.print(i);
pw.print(' ');
pw.print(w);
pw.println(":");
w.dump(pw, " ", dumpAll || windows != null);
}
}
if (mInputMethodDialogs.size() > 0) {
pw.println();
pw.println(" Input method dialogs:");
for (int i = mInputMethodDialogs.size() - 1; i >= 0; i--) {
WindowState w = mInputMethodDialogs.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" IM Dialog #");
pw.print(i);
pw.print(": ");
pw.println(w);
}
}
}
if (mPendingRemove.size() > 0) {
pw.println();
pw.println(" Remove pending for:");
for (int i = mPendingRemove.size() - 1; i >= 0; i--) {
WindowState w = mPendingRemove.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" Remove #");
pw.print(i);
pw.print(' ');
pw.print(w);
if (dumpAll) {
pw.println(":");
w.dump(pw, " ", true);
} else {
pw.println();
}
}
}
}
if (mForceRemoves != null && mForceRemoves.size() > 0) {
pw.println();
pw.println(" Windows force removing:");
for (int i = mForceRemoves.size() - 1; i >= 0; i--) {
WindowState w = mForceRemoves.get(i);
pw.print(" Removing #");
pw.print(i);
pw.print(' ');
pw.print(w);
if (dumpAll) {
pw.println(":");
w.dump(pw, " ", true);
} else {
pw.println();
}
}
}
if (mDestroySurface.size() > 0) {
pw.println();
pw.println(" Windows waiting to destroy their surface:");
for (int i = mDestroySurface.size() - 1; i >= 0; i--) {
WindowState w = mDestroySurface.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" Destroy #");
pw.print(i);
pw.print(' ');
pw.print(w);
if (dumpAll) {
pw.println(":");
w.dump(pw, " ", true);
} else {
pw.println();
}
}
}
}
if (mLosingFocus.size() > 0) {
pw.println();
pw.println(" Windows losing focus:");
for (int i = mLosingFocus.size() - 1; i >= 0; i--) {
WindowState w = mLosingFocus.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" Losing #");
pw.print(i);
pw.print(' ');
pw.print(w);
if (dumpAll) {
pw.println(":");
w.dump(pw, " ", true);
} else {
pw.println();
}
}
}
}
if (mResizingWindows.size() > 0) {
pw.println();
pw.println(" Windows waiting to resize:");
for (int i = mResizingWindows.size() - 1; i >= 0; i--) {
WindowState w = mResizingWindows.get(i);
if (windows == null || windows.contains(w)) {
pw.print(" Resizing #");
pw.print(i);
pw.print(' ');
pw.print(w);
if (dumpAll) {
pw.println(":");
w.dump(pw, " ", true);
} else {
pw.println();
}
}
}
}
if (mWaitingForDrawn.size() > 0) {
pw.println();
pw.println(" Clients waiting for these windows to be drawn:");
for (int i = mWaitingForDrawn.size() - 1; i >= 0; i--) {
Pair<WindowState, IRemoteCallback> pair = mWaitingForDrawn.get(i);
pw.print(" Waiting #");
pw.print(i);
pw.print(' ');
pw.print(pair.first);
pw.print(": ");
pw.println(pair.second);
}
}
pw.println();
if (mDisplay != null) {
pw.print(" Display: init=");
pw.print(mInitialDisplayWidth);
pw.print("x");
pw.print(mInitialDisplayHeight);
if (mInitialDisplayWidth != mBaseDisplayWidth || mInitialDisplayHeight != mBaseDisplayHeight) {
pw.print(" base=");
pw.print(mBaseDisplayWidth);
pw.print("x");
pw.print(mBaseDisplayHeight);
}
final int rawWidth = mDisplay.getRawWidth();
final int rawHeight = mDisplay.getRawHeight();
if (rawWidth != mCurDisplayWidth || rawHeight != mCurDisplayHeight) {
pw.print(" raw=");
pw.print(rawWidth);
pw.print("x");
pw.print(rawHeight);
}
pw.print(" cur=");
pw.print(mCurDisplayWidth);
pw.print("x");
pw.print(mCurDisplayHeight);
pw.print(" app=");
pw.print(mAppDisplayWidth);
pw.print("x");
pw.print(mAppDisplayHeight);
pw.print(" rng=");
pw.print(mSmallestDisplayWidth);
pw.print("x");
pw.print(mSmallestDisplayHeight);
pw.print("-");
pw.print(mLargestDisplayWidth);
pw.print("x");
pw.println(mLargestDisplayHeight);
} else {
pw.println(" NO DISPLAY");
}
pw.print(" mCurConfiguration=");
pw.println(this.mCurConfiguration);
pw.print(" mCurrentFocus=");
pw.println(mCurrentFocus);
if (mLastFocus != mCurrentFocus) {
pw.print(" mLastFocus=");
pw.println(mLastFocus);
}
pw.print(" mFocusedApp=");
pw.println(mFocusedApp);
if (mInputMethodTarget != null) {
pw.print(" mInputMethodTarget=");
pw.println(mInputMethodTarget);
}
pw.print(" mInTouchMode=");
pw.print(mInTouchMode);
pw.print(" mLayoutSeq=");
pw.println(mLayoutSeq);
if (dumpAll) {
pw.print(" mSystemDecorRect=");
pw.print(mSystemDecorRect.toShortString());
pw.print(" mSystemDecorLayer=");
pw.println(mSystemDecorLayer);
if (mLastStatusBarVisibility != 0) {
pw.print(" mLastStatusBarVisibility=0x");
pw.println(Integer.toHexString(mLastStatusBarVisibility));
}
if (mInputMethodWindow != null) {
pw.print(" mInputMethodWindow=");
pw.println(mInputMethodWindow);
}
pw.print(" mWallpaperTarget=");
pw.println(mWallpaperTarget);
if (mLowerWallpaperTarget != null && mUpperWallpaperTarget != null) {
pw.print(" mLowerWallpaperTarget=");
pw.println(mLowerWallpaperTarget);
pw.print(" mUpperWallpaperTarget=");
pw.println(mUpperWallpaperTarget);
}
pw.print(" mLastWallpaperX=");
pw.print(mLastWallpaperX);
pw.print(" mLastWallpaperY=");
pw.println(mLastWallpaperY);
if (mInputMethodAnimLayerAdjustment != 0 || mWallpaperAnimLayerAdjustment != 0) {
pw.print(" mInputMethodAnimLayerAdjustment=");
pw.print(mInputMethodAnimLayerAdjustment);
pw.print(" mWallpaperAnimLayerAdjustment=");
pw.println(mWallpaperAnimLayerAdjustment);
}
pw.print(" mSystemBooted=");
pw.print(mSystemBooted);
pw.print(" mDisplayEnabled=");
pw.println(mDisplayEnabled);
pw.print(" mLayoutNeeded=");
pw.print(mLayoutNeeded);
pw.print("mTransactionSequence=");
pw.println(mTransactionSequence);
pw.print(" mDisplayFrozen=");
pw.print(mDisplayFrozen);
pw.print(" mWindowsFreezingScreen=");
pw.print(mWindowsFreezingScreen);
pw.print(" mAppsFreezingScreen=");
pw.print(mAppsFreezingScreen);
pw.print(" mWaitingForConfig=");
pw.println(mWaitingForConfig);
pw.print(" mRotation=");
pw.print(mRotation);
pw.print(" mAltOrientation=");
pw.println(mAltOrientation);
pw.print(" mLastWindowForcedOrientation=");
pw.print(mLastWindowForcedOrientation);
pw.print(" mForcedAppOrientation=");
pw.println(mForcedAppOrientation);
pw.print(" mDeferredRotationPauseCount=");
pw.println(mDeferredRotationPauseCount);
if (mAnimator.mScreenRotationAnimation != null) {
pw.println(" mScreenRotationAnimation:");
mAnimator.mScreenRotationAnimation.printTo(" ", pw);
}
pw.print(" mWindowAnimationScale=");
pw.print(mWindowAnimationScale);
pw.print(" mTransitionWindowAnimationScale=");
pw.print(mTransitionAnimationScale);
pw.print(" mAnimatorDurationScale=");
pw.println(mAnimatorDurationScale);
pw.print(" mTraversalScheduled=");
pw.print(mTraversalScheduled);
pw.print(" mNextAppTransition=0x");
pw.print(Integer.toHexString(mNextAppTransition));
pw.print(" mAppTransitionReady=");
pw.println(mAppTransitionReady);
pw.print(" mAppTransitionRunning=");
pw.print(mAppTransitionRunning);
pw.print(" mAppTransitionTimeout=");
pw.println(mAppTransitionTimeout);
if (mNextAppTransitionType != ActivityOptions.ANIM_NONE) {
pw.print(" mNextAppTransitionType=");
pw.println(mNextAppTransitionType);
}
switch(mNextAppTransitionType) {
case ActivityOptions.ANIM_CUSTOM:
pw.print(" mNextAppTransitionPackage=");
pw.println(mNextAppTransitionPackage);
pw.print(" mNextAppTransitionEnter=0x");
pw.print(Integer.toHexString(mNextAppTransitionEnter));
pw.print(" mNextAppTransitionExit=0x");
pw.println(Integer.toHexString(mNextAppTransitionExit));
break;
case ActivityOptions.ANIM_SCALE_UP:
pw.print(" mNextAppTransitionStartX=");
pw.print(mNextAppTransitionStartX);
pw.print(" mNextAppTransitionStartY=");
pw.println(mNextAppTransitionStartY);
pw.print(" mNextAppTransitionStartWidth=");
pw.print(mNextAppTransitionStartWidth);
pw.print(" mNextAppTransitionStartHeight=");
pw.println(mNextAppTransitionStartHeight);
break;
case ActivityOptions.ANIM_THUMBNAIL:
case ActivityOptions.ANIM_THUMBNAIL_DELAYED:
pw.print(" mNextAppTransitionThumbnail=");
pw.print(mNextAppTransitionThumbnail);
pw.print(" mNextAppTransitionStartX=");
pw.print(mNextAppTransitionStartX);
pw.print(" mNextAppTransitionStartY=");
pw.println(mNextAppTransitionStartY);
pw.print(" mNextAppTransitionDelayed=");
pw.println(mNextAppTransitionDelayed);
break;
}
if (mNextAppTransitionCallback != null) {
pw.print(" mNextAppTransitionCallback=");
pw.println(mNextAppTransitionCallback);
}
pw.print(" mStartingIconInTransition=");
pw.print(mStartingIconInTransition);
pw.print(" mSkipAppTransitionAnimation=");
pw.println(mSkipAppTransitionAnimation);
pw.println(" Window Animator:");
mAnimator.dump(pw, " ", dumpAll);
}
}
use of android.os.IRemoteCallback in project platform_frameworks_base by android.
the class UserController method dispatchUserSwitch.
void dispatchUserSwitch(final UserState uss, final int oldUserId, final int newUserId) {
Slog.d(TAG, "Dispatch onUserSwitching oldUser #" + oldUserId + " newUser #" + newUserId);
final int observerCount = mUserSwitchObservers.beginBroadcast();
if (observerCount > 0) {
final ArraySet<String> curWaitingUserSwitchCallbacks = new ArraySet<>();
synchronized (mService) {
uss.switching = true;
mCurWaitingUserSwitchCallbacks = curWaitingUserSwitchCallbacks;
}
final AtomicInteger waitingCallbacksCount = new AtomicInteger(observerCount);
for (int i = 0; i < observerCount; i++) {
try {
// Prepend with unique prefix to guarantee that keys are unique
final String name = "#" + i + " " + mUserSwitchObservers.getBroadcastCookie(i);
synchronized (mService) {
curWaitingUserSwitchCallbacks.add(name);
}
final IRemoteCallback callback = new IRemoteCallback.Stub() {
@Override
public void sendResult(Bundle data) throws RemoteException {
synchronized (mService) {
// Early return if this session is no longer valid
if (curWaitingUserSwitchCallbacks != mCurWaitingUserSwitchCallbacks) {
return;
}
curWaitingUserSwitchCallbacks.remove(name);
// Continue switching if all callbacks have been notified
if (waitingCallbacksCount.decrementAndGet() == 0) {
sendContinueUserSwitchLocked(uss, oldUserId, newUserId);
}
}
}
};
mUserSwitchObservers.getBroadcastItem(i).onUserSwitching(newUserId, callback);
} catch (RemoteException e) {
}
}
} else {
synchronized (mService) {
sendContinueUserSwitchLocked(uss, oldUserId, newUserId);
}
}
mUserSwitchObservers.finishBroadcast();
}
use of android.os.IRemoteCallback in project platform_frameworks_base by android.
the class WallpaperManagerService method systemReady.
void systemReady() {
if (DEBUG)
Slog.v(TAG, "systemReady");
WallpaperData wallpaper = mWallpaperMap.get(UserHandle.USER_SYSTEM);
// sure we have something to render
if (mImageWallpaper.equals(wallpaper.nextWallpaperComponent)) {
// No crop file? Make sure we've finished the processing sequence if necessary
if (!wallpaper.cropExists()) {
if (DEBUG) {
Slog.i(TAG, "No crop; regenerating from source");
}
generateCrop(wallpaper);
}
// Still nothing? Fall back to default.
if (!wallpaper.cropExists()) {
if (DEBUG) {
Slog.i(TAG, "Unable to regenerate crop; resetting");
}
clearWallpaperLocked(false, FLAG_SYSTEM, UserHandle.USER_SYSTEM, null);
}
} else {
if (DEBUG) {
Slog.i(TAG, "Nondefault wallpaper component; gracefully ignoring");
}
}
IntentFilter userFilter = new IntentFilter();
userFilter.addAction(Intent.ACTION_USER_REMOVED);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (Intent.ACTION_USER_REMOVED.equals(action)) {
onRemoveUser(intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL));
}
}
}, userFilter);
final IntentFilter shutdownFilter = new IntentFilter(Intent.ACTION_SHUTDOWN);
mContext.registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
if (DEBUG) {
Slog.i(TAG, "Shutting down");
}
synchronized (mLock) {
mShuttingDown = true;
}
}
}
}, shutdownFilter);
try {
ActivityManagerNative.getDefault().registerUserSwitchObserver(new IUserSwitchObserver.Stub() {
@Override
public void onUserSwitching(int newUserId, IRemoteCallback reply) {
switchUser(newUserId, reply);
}
@Override
public void onUserSwitchComplete(int newUserId) throws RemoteException {
}
@Override
public void onForegroundProfileSwitch(int newProfileId) {
// Ignore.
}
}, TAG);
} catch (RemoteException e) {
e.rethrowAsRuntimeException();
}
}
use of android.os.IRemoteCallback in project platform_frameworks_base by android.
the class NetworkScoreServiceTest method testRequestRecommendation_resultReturned.
@Test
public void testRequestRecommendation_resultReturned() throws Exception {
injectProvider();
when(mContext.getMainLooper()).thenReturn(Looper.getMainLooper());
final WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.SSID = "testRequestRecommendation_resultReturned_SSID";
wifiConfiguration.BSSID = "testRequestRecommendation_resultReturned_BSSID";
final RecommendationResult providerResult = RecommendationResult.createConnectRecommendation(wifiConfiguration);
final Bundle bundle = new Bundle();
bundle.putParcelable(EXTRA_RECOMMENDATION_RESULT, providerResult);
doAnswer(invocation -> {
bundle.putInt(EXTRA_SEQUENCE, invocation.getArgument(2));
invocation.<IRemoteCallback>getArgument(1).sendResult(bundle);
return null;
}).when(mRecommendationProvider).requestRecommendation(eq(mRecommendationRequest), isA(IRemoteCallback.class), anyInt());
final RecommendationResult result = mNetworkScoreService.requestRecommendation(mRecommendationRequest);
assertNotNull(result);
assertEquals(providerResult.getWifiConfiguration().SSID, result.getWifiConfiguration().SSID);
assertEquals(providerResult.getWifiConfiguration().BSSID, result.getWifiConfiguration().BSSID);
}
use of android.os.IRemoteCallback in project android_frameworks_base by DirtyUnicorns.
the class AppTransition method createAspectScaledThumbnailFreeformAnimationLocked.
private AnimationSet createAspectScaledThumbnailFreeformAnimationLocked(Rect sourceFrame, Rect destFrame, @Nullable Rect surfaceInsets, boolean enter) {
final float sourceWidth = sourceFrame.width();
final float sourceHeight = sourceFrame.height();
final float destWidth = destFrame.width();
final float destHeight = destFrame.height();
final float scaleH = enter ? sourceWidth / destWidth : destWidth / sourceWidth;
final float scaleV = enter ? sourceHeight / destHeight : destHeight / sourceHeight;
AnimationSet set = new AnimationSet(true);
final int surfaceInsetsH = surfaceInsets == null ? 0 : surfaceInsets.left + surfaceInsets.right;
final int surfaceInsetsV = surfaceInsets == null ? 0 : surfaceInsets.top + surfaceInsets.bottom;
// We want the scaling to happen from the center of the surface. In order to achieve that,
// we need to account for surface insets that will be used to enlarge the surface.
final float scaleHCenter = ((enter ? destWidth : sourceWidth) + surfaceInsetsH) / 2;
final float scaleVCenter = ((enter ? destHeight : sourceHeight) + surfaceInsetsV) / 2;
final ScaleAnimation scale = enter ? new ScaleAnimation(scaleH, 1, scaleV, 1, scaleHCenter, scaleVCenter) : new ScaleAnimation(1, scaleH, 1, scaleV, scaleHCenter, scaleVCenter);
final int sourceHCenter = sourceFrame.left + sourceFrame.width() / 2;
final int sourceVCenter = sourceFrame.top + sourceFrame.height() / 2;
final int destHCenter = destFrame.left + destFrame.width() / 2;
final int destVCenter = destFrame.top + destFrame.height() / 2;
final int fromX = enter ? sourceHCenter - destHCenter : destHCenter - sourceHCenter;
final int fromY = enter ? sourceVCenter - destVCenter : destVCenter - sourceVCenter;
final TranslateAnimation translation = enter ? new TranslateAnimation(fromX, 0, fromY, 0) : new TranslateAnimation(0, fromX, 0, fromY);
set.addAnimation(scale);
set.addAnimation(translation);
final IRemoteCallback callback = mAnimationFinishedCallback;
if (callback != null) {
set.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mService.mH.obtainMessage(H.DO_ANIMATION_CALLBACK, callback).sendToTarget();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
}
return set;
}
Aggregations