public abstract class

MAMActivity

extends Activity
implements HookedActivity
java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
         ↳ android.app.Activity
           ↳ com.microsoft.intune.mam.client.app.MAMActivity

Class Overview

MAM version of android.app.Activity.

Summary

[Expand]
Inherited Constants
From class android.app.Activity
From class android.content.Context
From interface android.content.ComponentCallbacks2
[Expand]
Inherited Fields
From class android.app.Activity
Public Constructors
MAMActivity()
Public Methods
static void defaultOnMAMIdentitySwitchRequired(Activity activity, String identity, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)
static void defaultOnMAMIdentitySwitchRequired(Activity activity, String upn, String oid, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)
Expose default behavior for notifying the app that an incoming intent requires an identity switch for this Activity.
boolean onCreateThumbnail(Bitmap outBitmap, Canvas canvas)
View onCreateView(View parent, String name, Context context, AttributeSet attrs)
void onMAMActivityResult(int requestCode, int resultCode, Intent data)
MAM version of onActivityResult.
void onMAMCreate(Bundle savedInstanceState)
MAM version of onCreate.
View onMAMCreateView(View parent, String name, Context context, AttributeSet attrs)
MAM version of onCreateView.
void onMAMDestroy()
MAM version of onDestroy.
void onMAMIdentitySwitchRequired(String upn, String oid, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)
Called by MAM to notify the app that an incoming intent requires an identity switch for this Activity.
void onMAMIdentitySwitchRequired(String identity, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)
Called by MAM to notify the app that an incoming intent requires an identity switch for this Activity.
void onMAMNewIntent(Intent intent)
MAM version of onNewIntent.
void onMAMPause()
MAM version of onPause.
boolean onMAMPictureInPictureRequested()
MAM version of onPictureInPictureRequested.
void onMAMPostCreate(Bundle savedInstanceState)
MAM version of onPostCreate.
void onMAMPostResume()
MAM version of onPostResume.
boolean onMAMPrepareOptionsMenu(Menu menu)
MAM version of onPrepareOptionsMenu.
void onMAMProvideAssistContent(AssistContent content)
MAM version of onProvideAssistContent.
Uri onMAMProvideReferrer()
MAM version on onProviderReferrer.
final void onMAMRawProvideAssistContent(Object content)
MAM version of onProvideAssistContent.
final boolean onMAMRawSearchRequested(Object event)
MAM version of onSearchRequested.
void onMAMResume()
MAM version of onResume.
void onMAMSaveInstanceState(Bundle outState)
MAM version of onSaveInstanceState.
boolean onMAMSearchRequested(SearchEvent event)
MAM version of onSearchRequested.
void onMAMStateNotSaved()
MAM Version of onStateNotSaved.
void onMAMUserLeaveHint()
MAM version of onUserLeaveHint.
boolean onPictureInPictureRequested()
boolean onPictureInPictureRequestedReal()
final boolean onPrepareOptionsMenu(Menu menu)
final void onProvideAssistContent(AssistContent content)
Uri onProvideReferrer()
final void onSaveInstanceState(Bundle outState)
final boolean onSearchRequested(SearchEvent event)
void onStateNotSaved()
void onSwitchMAMIdentityComplete(MAMIdentitySwitchResult result)
Called by MAM to notify the app that the identity switch for this Activity has completed.
void registerActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback)
void startActivities(Intent[] intents, Bundle options)
void startActivityForResult(Intent intent, int requestCode)
void startActivityForResult(Intent intent, int requestCode, Bundle options)
void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode)
void startActivityFromFragment(Fragment fragment, Intent intent, int requestCode, Bundle options)
boolean startActivityIfNeeded(Intent intent, int requestCode)
boolean startActivityIfNeeded(Intent intent, int requestCode, Bundle options)
final void switchMAMIdentity(String newIdentity, EnumSet<IdentitySwitchOption> options)
Set new identity.
final void switchMAMIdentityOID(String newOid, EnumSet<IdentitySwitchOption> options)
Set new identity.
void unregisterActivityLifecycleCallbacks(Application.ActivityLifecycleCallbacks callback)
Protected Methods
void attachBaseContext(Context context)
final void onActivityResult(int requestCode, int resultCode, Intent data)
final void onCreate(Bundle savedInstanceState)
final void onDestroy()
final void onNewIntent(Intent intent)
final void onPause()
final void onPostCreate(Bundle savedInstanceState)
final void onPostResume()
final void onResume()
void onUserLeaveHint()
[Expand]
Inherited Methods
From class android.app.Activity
From class android.view.ContextThemeWrapper
From class android.content.ContextWrapper
From class android.content.Context
From class java.lang.Object
From interface android.content.ComponentCallbacks
From interface android.content.ComponentCallbacks2
From interface android.view.KeyEvent.Callback
From interface android.view.LayoutInflater.Factory
From interface android.view.LayoutInflater.Factory2
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback
From interface com.microsoft.intune.mam.client.app.HookedActivity
From interface com.microsoft.intune.mam.client.app.MAMActivityBlockingListener
From interface com.microsoft.intune.mam.client.app.MAMActivityIdentityRequirementListener
From interface com.microsoft.intune.mam.client.app.MAMActivityIdentitySwitchListener

Public Constructors

public MAMActivity ()

Public Methods

public static void defaultOnMAMIdentitySwitchRequired (Activity activity, String identity, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)

This method is deprecated.
Use defaultOnMAMIdentitySwitchRequired(Activity, String, String, AppIdentitySwitchReason, AppIdentitySwitchResultCallback).

Expose default behavior for notifying the app that an incoming intent requires an identity switch for this Activity. The Activity will be checked if it is MAM-integrated and, if so, the default onMAMIdentitySwitchRequired behavior will be called.

Parameters
activity The activity to perform an identity switch for.
identity identity being switched to
reason reason identity is being switched.
callback must be called to notify MAM whether to allow the switch.

public static void defaultOnMAMIdentitySwitchRequired (Activity activity, String upn, String oid, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)

Expose default behavior for notifying the app that an incoming intent requires an identity switch for this Activity. The Activity will be checked if it is MAM-integrated and, if so, the default onMAMIdentitySwitchRequired behavior will be called.

Parameters
activity The activity to perform an identity switch for.
upn UPN of the identity being switched to.
oid AAD OID of the identity being switched to.
reason reason identity is being switched.
callback must be called to notify MAM whether to allow the switch.

public boolean onCreateThumbnail (Bitmap outBitmap, Canvas canvas)

public View onCreateView (View parent, String name, Context context, AttributeSet attrs)

public void onMAMActivityResult (int requestCode, int resultCode, Intent data)

MAM version of onActivityResult.

Parameters
requestCode Request code.
resultCode Result code.
data Intent data.

public void onMAMCreate (Bundle savedInstanceState)

MAM version of onCreate.

Parameters
savedInstanceState Saved instance state.

public View onMAMCreateView (View parent, String name, Context context, AttributeSet attrs)

MAM version of onCreateView. See Android documentation for more info.

Parameters
parent parent
name name
context context
attrs attrs
Returns
  • view

public void onMAMDestroy ()

MAM version of onDestroy.

public void onMAMIdentitySwitchRequired (String upn, String oid, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)

Called by MAM to notify the app that an incoming intent requires an identity switch for this Activity. This can occur during activity creation or when a new intent is sent to an existing activity. The application must call callback.reportIdentitySwitchResult to tell MAM whether the identity switch is allowed. In general, applications should allow identity switches. The default implementation allows all identity switches. When using the build plugin, the default implementation can be accessed by calling MAMctivity.defaultOnMAMIdentitySwitchRequired. The most common case for this method to be called is before onMAMCreate. The application is allowed to show UI to confirm the identity switch, but it must show the UI using a different activity as onMAMCreate will not be called for this activity until the identity switch is allowed. Special care must be taken with single-top activities when a new intent can cause an identity switch. If a new intent causes an identity switch, after the switch is approved by this method, onMAMNewIntent will be called and then recreate() will be called which is necessary to enforce screenshot restrictions from the new policy. It is strongly recommended that the implementation of onMAMNewIntent call setIntent, as otherwise the following recreate may cause the original intent rather than the new intent to be displayed.

Parameters
upn UPN of the identity being switched to
oid AAD OID of the identity being switched to
reason reason identity is being switched
callback must be called to notify MAM whether to allow the switch.

public void onMAMIdentitySwitchRequired (String identity, AppIdentitySwitchReason reason, AppIdentitySwitchResultCallback callback)

Called by MAM to notify the app that an incoming intent requires an identity switch for this Activity. This can occur during activity creation or when a new intent is sent to an existing activity. The application must call callback.reportIdentitySwitchResult to tell MAM whether the identity switch is allowed. In general, applications should allow identity switches. The default implementation allows all identity switches. When using the build plugin, the default implementation can be accessed by calling MAMctivity.defaultOnMAMIdentitySwitchRequired. The most common case for this method to be called is before onMAMCreate. The application is allowed to show UI to confirm the identity switch, but it must show the UI using a different activity as onMAMCreate will not be called for this activity until the identity switch is allowed. Special care must be taken with single-top activities when a new intent can cause an identity switch. If a new intent causes an identity switch, after the switch is approved by this method, onMAMNewIntent will be called and then recreate() will be called which is necessary to enforce screenshot restrictions from the new policy. It is strongly recommended that the implementation of onMAMNewIntent call setIntent, as otherwise the following recreate may cause the original intent rather than the new intent to be displayed.

Parameters
identity identity being switched to
reason reason identity is being switched
callback must be called to notify MAM whether to allow the switch.

public void onMAMNewIntent (Intent intent)

MAM version of onNewIntent.

Parameters
intent intent to process

public void onMAMPause ()

MAM version of onPause.

public boolean onMAMPictureInPictureRequested ()

MAM version of onPictureInPictureRequested.

Returns
  • true if the activity received this callback regardless of if it acts on it or not. If false, the framework will assume the app hasn't been updated to leverage this callback and will in turn send a legacy callback of onUserLeaveHint() for the app to enter picture-in-picture mode.

public void onMAMPostCreate (Bundle savedInstanceState)

MAM version of onPostCreate.

Parameters
savedInstanceState Saved instance state.

public void onMAMPostResume ()

MAM version of onPostResume.

public boolean onMAMPrepareOptionsMenu (Menu menu)

MAM version of onPrepareOptionsMenu.

Parameters
menu menu
Returns
  • true to display the menu

public void onMAMProvideAssistContent (AssistContent content)

MAM version of onProvideAssistContent.

Parameters
content content

public Uri onMAMProvideReferrer ()

MAM version on onProviderReferrer.

Returns
  • URI representing referrer.

public final void onMAMRawProvideAssistContent (Object content)

MAM version of onProvideAssistContent.

Parameters
content AssistContent. We use raw object type, otherwise InterProxy will throw class not found errors on downlevel devices.

public final boolean onMAMRawSearchRequested (Object event)

MAM version of onSearchRequested.

Parameters
event SearchEvent. We use raw object type, otherwise InterProxy will throw class not found errors on downlevel devices.
Returns
  • false if activity blocks the search.

public void onMAMResume ()

MAM version of onResume.

public void onMAMSaveInstanceState (Bundle outState)

MAM version of onSaveInstanceState.

Parameters
outState Out state.

public boolean onMAMSearchRequested (SearchEvent event)

MAM version of onSearchRequested.

Parameters
event event
Returns
  • true if the search request is allowed

public void onMAMStateNotSaved ()

MAM Version of onStateNotSaved.

public void onMAMUserLeaveHint ()

MAM version of onUserLeaveHint.

public boolean onPictureInPictureRequested ()

public boolean onPictureInPictureRequestedReal ()

public final boolean onPrepareOptionsMenu (Menu menu)

public final void onProvideAssistContent (AssistContent content)

public Uri onProvideReferrer ()

public final void onSaveInstanceState (Bundle outState)

public final boolean onSearchRequested (SearchEvent event)

public void onStateNotSaved ()

public void onSwitchMAMIdentityComplete (MAMIdentitySwitchResult result)

Called by MAM to notify the app that the identity switch for this Activity has completed.

Parameters
result Result of the MAM identity switch.

public void registerActivityLifecycleCallbacks (Application.ActivityLifecycleCallbacks callback)

public void startActivities (Intent[] intents, Bundle options)

public void startActivityForResult (Intent intent, int requestCode)

public void startActivityForResult (Intent intent, int requestCode, Bundle options)

public void startActivityFromFragment (Fragment fragment, Intent intent, int requestCode)

public void startActivityFromFragment (Fragment fragment, Intent intent, int requestCode, Bundle options)

public boolean startActivityIfNeeded (Intent intent, int requestCode)

public boolean startActivityIfNeeded (Intent intent, int requestCode, Bundle options)

public final void switchMAMIdentity (String newIdentity, EnumSet<IdentitySwitchOption> options)

Set new identity.

Parameters
newIdentity New identity
options Identity switch options.

public final void switchMAMIdentityOID (String newOid, EnumSet<IdentitySwitchOption> options)

Set new identity.

Parameters
newOid AAD OID of the new identity.
options Identity switch options.

public void unregisterActivityLifecycleCallbacks (Application.ActivityLifecycleCallbacks callback)

Protected Methods

protected void attachBaseContext (Context context)

protected final void onActivityResult (int requestCode, int resultCode, Intent data)

protected final void onCreate (Bundle savedInstanceState)

protected final void onDestroy ()

protected final void onNewIntent (Intent intent)

protected final void onPause ()

protected final void onPostCreate (Bundle savedInstanceState)

protected final void onPostResume ()

protected final void onResume ()

protected void onUserLeaveHint ()