use of android.view.WindowManager in project platform_frameworks_base by android.
the class SurfaceCompositionMeasuringActivity method detectRefreshRate.
private void detectRefreshRate() {
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
mRefreshRate = wm.getDefaultDisplay().getRefreshRate();
if (mRefreshRate < MIN_REFRESH_RATE_SUPPORTED)
throw new RuntimeException("Unsupported display refresh rate: " + mRefreshRate);
mTargetFPS = mRefreshRate - 2.0f;
}
use of android.view.WindowManager in project platform_frameworks_base by android.
the class WallpaperManagerService method getMaximumSizeDimension.
private int getMaximumSizeDimension() {
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
Display d = wm.getDefaultDisplay();
return d.getMaximumSizeDimension();
}
use of android.view.WindowManager in project platform_frameworks_base by android.
the class ActivityThread method handleDestroyActivity.
private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) {
ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance);
if (r != null) {
cleanUpPendingRemoveWindows(r, finishing);
WindowManager wm = r.activity.getWindowManager();
View v = r.activity.mDecor;
if (v != null) {
if (r.activity.mVisibleFromServer) {
mNumVisibleActivities--;
}
IBinder wtoken = v.getWindowToken();
if (r.activity.mWindowAdded) {
if (r.mPreserveWindow) {
// Hold off on removing this until the new activity's
// window is being added.
r.mPendingRemoveWindow = r.window;
r.mPendingRemoveWindowManager = wm;
// We can only keep the part of the view hierarchy that we control,
// everything else must be removed, because it might not be able to
// behave properly when activity is relaunching.
r.window.clearContentView();
} else {
wm.removeViewImmediate(v);
}
}
if (wtoken != null && r.mPendingRemoveWindow == null) {
WindowManagerGlobal.getInstance().closeAll(wtoken, r.activity.getClass().getName(), "Activity");
} else if (r.mPendingRemoveWindow != null) {
// We're preserving only one window, others should be closed so app views
// will be detached before the final tear down. It should be done now because
// some components (e.g. WebView) rely on detach callbacks to perform receiver
// unregister and other cleanup.
WindowManagerGlobal.getInstance().closeAllExceptView(token, v, r.activity.getClass().getName(), "Activity");
}
r.activity.mDecor = null;
}
if (r.mPendingRemoveWindow == null) {
// If we are delaying the removal of the activity window, then
// we can't clean up all windows here. Note that we can't do
// so later either, which means any windows that aren't closed
// by the app will leak. Well we try to warning them a lot
// about leaking windows, because that is a bug, so if they are
// using this recreate facility then they get to live with leaks.
WindowManagerGlobal.getInstance().closeAll(token, r.activity.getClass().getName(), "Activity");
}
// Mocked out contexts won't be participating in the normal
// process lifecycle, but if we're running with a proper
// ApplicationContext we need to have it tear down things
// cleanly.
Context c = r.activity.getBaseContext();
if (c instanceof ContextImpl) {
((ContextImpl) c).scheduleFinalCleanup(r.activity.getClass().getName(), "Activity");
}
}
if (finishing) {
try {
ActivityManagerNative.getDefault().activityDestroyed(token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
mSomeActivitiesChanged = true;
}
use of android.view.WindowManager in project platform_frameworks_base by android.
the class MenuPopupHelper method createPopup.
/**
* Creates the popup and assigns cached properties.
*
* @return an initialized popup
*/
@NonNull
private MenuPopup createPopup() {
final WindowManager windowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
final Display display = windowManager.getDefaultDisplay();
final Point displaySize = new Point();
display.getRealSize(displaySize);
final int smallestWidth = Math.min(displaySize.x, displaySize.y);
final int minSmallestWidthCascading = mContext.getResources().getDimensionPixelSize(com.android.internal.R.dimen.cascading_menus_min_smallest_width);
final boolean enableCascadingSubmenus = smallestWidth >= minSmallestWidthCascading;
final MenuPopup popup;
if (enableCascadingSubmenus) {
popup = new CascadingMenuPopup(mContext, mAnchorView, mPopupStyleAttr, mPopupStyleRes, mOverflowOnly);
} else {
popup = new StandardMenuPopup(mContext, mMenu, mAnchorView, mPopupStyleAttr, mPopupStyleRes, mOverflowOnly);
}
// Assign immutable properties.
popup.addMenu(mMenu);
popup.setOnDismissListener(mInternalOnDismissListener);
// Assign mutable properties. These may be reassigned later.
popup.setAnchorView(mAnchorView);
popup.setCallback(mPresenterCallback);
popup.setForceShowIcon(mForceShowIcon);
popup.setGravity(mDropDownGravity);
return popup;
}
use of android.view.WindowManager in project Talon-for-Twitter by klinker24.
the class EmojiKeyboard method onFinishInflate.
@Override
protected void onFinishInflate() {
try {
try {
getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial", PackageManager.GET_META_DATA);
} catch (Exception e) {
getContext().getPackageManager().getPackageInfo("com.klinker.android.emoji_keyboard_trial_ios", PackageManager.GET_META_DATA);
}
emojiPager = (ViewPager) findViewById(R.id.emojiKeyboardPager);
backspace = (ImageButton) findViewById(R.id.delete);
Display d = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
keyboardHeight = (int) (d.getHeight() / 3.0);
dataSource = new EmojiDataSource(getContext());
dataSource.open();
recents = (ArrayList<Recent>) dataSource.getAllRecents();
emojiPager.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, keyboardHeight));
tabs = (PagerSlidingTabStrip) findViewById(R.id.emojiTabs);
tabs.setIndicatorColor(getResources().getColor(R.color.app_color));
emojiPagerAdapter = new EmojiPagerAdapter(getContext(), emojiPager);
emojiPager.setAdapter(emojiPagerAdapter);
tabs.setViewPager(emojiPager);
emojiPager.setCurrentItem(1);
backspace.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
removeText();
}
});
} catch (Exception e) {
}
}
Aggregations