List of usage examples for android.app ActivityManagerNative getDefault
@UnsupportedAppUsage static public IActivityManager getDefault()
From source file:android.app.Activity.java
/** * Move the task containing this activity to the back of the activity * stack. The activity's order within the task is unchanged. * /* www .java2 s . c o m*/ * @param nonRoot If false then this only works if the activity is the root * of a task; if true it will work for any activity in * a task. * * @return If the task was moved (or it was already at the * back) true is returned, else false. */ public boolean moveTaskToBack(boolean nonRoot) { try { return ActivityManagerNative.getDefault().moveActivityTaskToBack(mToken, nonRoot); } catch (RemoteException e) { // Empty } return false; }
From source file:android.app.Activity.java
/** * Bit indicating that this activity is "immersive" and should not be * interrupted by notifications if possible. * * This value is initially set by the manifest property * <code>android:immersive</code> but may be changed at runtime by * {@link #setImmersive}.//from w w w .jav a2 s . c o m * * @see #setImmersive(boolean) * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE */ public boolean isImmersive() { try { return ActivityManagerNative.getDefault().isImmersive(mToken); } catch (RemoteException e) { return false; } }
From source file:android.app.Activity.java
/** * Convert a translucent themed Activity {@link android.R.attr#windowIsTranslucent} to a * fullscreen opaque Activity.//from w ww.j a v a2 s .c o m * <p> * Call this whenever the background of a translucent Activity has changed to become opaque. * Doing so will allow the {@link android.view.Surface} of the Activity behind to be released. * <p> * This call has no effect on non-translucent activities or on activities with the * {@link android.R.attr#windowIsFloating} attribute. * * @see #convertToTranslucent(TranslucentConversionListener) * @see TranslucentConversionListener * * @hide */ public void convertFromTranslucent() { try { mTranslucentCallback = null; if (ActivityManagerNative.getDefault().convertFromTranslucent(mToken)) { WindowManagerGlobal.getInstance().changeCanvasOpacity(mToken, true); } } catch (RemoteException e) { // pass } }
From source file:android.app.Activity.java
/** * Convert a translucent themed Activity {@link android.R.attr#windowIsTranslucent} back from * opaque to translucent following a call to {@link #convertFromTranslucent()}. * <p>//from ww w. ja v a2 s.c om * Calling this allows the Activity behind this one to be seen again. Once all such Activities * have been redrawn {@link TranslucentConversionListener#onTranslucentConversionComplete} will * be called indicating that it is safe to make this activity translucent again. Until * {@link TranslucentConversionListener#onTranslucentConversionComplete} is called the image * behind the frontmost Activity will be indeterminate. * <p> * This call has no effect on non-translucent activities or on activities with the * {@link android.R.attr#windowIsFloating} attribute. * * @param callback the method to call when all visible Activities behind this one have been * drawn and it is safe to make this Activity translucent again. * * @see #convertFromTranslucent() * @see TranslucentConversionListener * * @hide */ public void convertToTranslucent(TranslucentConversionListener callback) { try { mTranslucentCallback = callback; mChangeCanvasToTranslucent = ActivityManagerNative.getDefault().convertToTranslucent(mToken); } catch (RemoteException e) { // pass } }
From source file:android.app.Activity.java
/** * Adjust the current immersive mode setting. * * Note that changing this value will have no effect on the activity's * {@link android.content.pm.ActivityInfo} structure; that is, if * <code>android:immersive</code> is set to <code>true</code> * in the application's manifest entry for this activity, the {@link * android.content.pm.ActivityInfo#flags ActivityInfo.flags} member will * always have its {@link android.content.pm.ActivityInfo#FLAG_IMMERSIVE * FLAG_IMMERSIVE} bit set.//w ww. ja v a2s.c o m * * @see #isImmersive() * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE */ public void setImmersive(boolean i) { try { ActivityManagerNative.getDefault().setImmersive(mToken, i); } catch (RemoteException e) { // pass } }
From source file:android.app.Activity.java
/** * Returns true if the app should recreate the task when navigating 'up' from this activity * by using targetIntent./*from www. j a v a2 s .c o m*/ * * <p>If this method returns false the app can trivially call * {@link #navigateUpTo(Intent)} using the same parameters to correctly perform * up navigation. If this method returns false, the app should synthesize a new task stack * by using {@link TaskStackBuilder} or another similar mechanism to perform up navigation.</p> * * @param targetIntent An intent representing the target destination for up navigation * @return true if navigating up should recreate a new task stack, false if the same task * should be used for the destination */ public boolean shouldUpRecreateTask(Intent targetIntent) { try { PackageManager pm = getPackageManager(); ComponentName cn = targetIntent.getComponent(); if (cn == null) { cn = targetIntent.resolveActivity(pm); } ActivityInfo info = pm.getActivityInfo(cn, 0); if (info.taskAffinity == null) { return false; } return !ActivityManagerNative.getDefault().targetTaskAffinityMatchesActivity(mToken, info.taskAffinity); } catch (RemoteException e) { return false; } catch (NameNotFoundException e) { return false; } }
From source file:android.app.Activity.java
/** * Navigate from this activity to the activity specified by upIntent, finishing this activity * in the process. If the activity indicated by upIntent already exists in the task's history, * this activity and all others before the indicated activity in the history stack will be * finished./*from w w w. j ava2 s . com*/ * * <p>If the indicated activity does not appear in the history stack, this will finish * each activity in this task until the root activity of the task is reached, resulting in * an "in-app home" behavior. This can be useful in apps with a complex navigation hierarchy * when an activity may be reached by a path not passing through a canonical parent * activity.</p> * * <p>This method should be used when performing up navigation from within the same task * as the destination. If up navigation should cross tasks in some cases, see * {@link #shouldUpRecreateTask(Intent)}.</p> * * @param upIntent An intent representing the target destination for up navigation * * @return true if up navigation successfully reached the activity indicated by upIntent and * upIntent was delivered to it. false if an instance of the indicated activity could * not be found and this activity was simply finished normally. */ public boolean navigateUpTo(Intent upIntent) { if (mParent == null) { ComponentName destInfo = upIntent.getComponent(); if (destInfo == null) { destInfo = upIntent.resolveActivity(getPackageManager()); if (destInfo == null) { return false; } upIntent = new Intent(upIntent); upIntent.setComponent(destInfo); } int resultCode; Intent resultData; synchronized (this) { resultCode = mResultCode; resultData = mResultData; } if (resultData != null) { resultData.prepareToLeaveProcess(); } try { upIntent.prepareToLeaveProcess(); return ActivityManagerNative.getDefault().navigateUpTo(mToken, upIntent, resultCode, resultData); } catch (RemoteException e) { return false; } } else { return mParent.navigateUpToFromChild(this, upIntent); } }