Exemplo n.º 1
0
		public virtual android.app.PendingIntent createPendingResult(int requestCode, android.content.Intent
			 data, int flags)
		{
			string packageName = getPackageName();
			try
			{
				data.setAllowFds(false);
				android.content.IIntentSender target = android.app.ActivityManagerNative.getDefault
					().getIntentSender(android.app.IActivityManagerClass.INTENT_SENDER_ACTIVITY_RESULT
					, packageName, mParent == null ? mToken : mParent.mToken, mEmbeddedID, requestCode
					, new android.content.Intent[] { data }, null, flags);
				return target != null ? new android.app.PendingIntent(target) : null;
			}
			catch (android.os.RemoteException)
			{
			}
			return null;
		}
Exemplo n.º 2
0
		public virtual bool startActivityIfNeeded(android.content.Intent intent, int requestCode
			)
		{
			if (mParent == null)
			{
				int result = android.app.IActivityManagerClass.START_RETURN_INTENT_TO_CALLER;
				try
				{
					intent.setAllowFds(false);
					result = android.app.ActivityManagerNative.getDefault().startActivity(mMainThread
						.getApplicationThread(), intent, intent.resolveTypeIfNeeded(getContentResolver()
						), null, 0, mToken, mEmbeddedID, requestCode, true, false, null, null, false);
				}
				catch (android.os.RemoteException)
				{
				}
				android.app.Instrumentation.checkStartActivityResult(result, intent);
				if (requestCode >= 0)
				{
					mStartedActivity = true;
				}
				return result != android.app.IActivityManagerClass.START_RETURN_INTENT_TO_CALLER;
			}
			throw new System.NotSupportedException("startActivityIfNeeded can only be called from a top-level activity"
				);
		}
Exemplo n.º 3
0
		public virtual bool startNextMatchingActivity(android.content.Intent intent)
		{
			if (mParent == null)
			{
				try
				{
					intent.setAllowFds(false);
					return android.app.ActivityManagerNative.getDefault().startNextMatchingActivity(mToken
						, intent);
				}
				catch (android.os.RemoteException)
				{
				}
				return false;
			}
			throw new System.NotSupportedException("startNextMatchingActivity can only be called from a top-level activity"
				);
		}
Exemplo n.º 4
0
		public override bool startInstrumentation(android.content.ComponentName className
			, string profileFile, android.os.Bundle arguments)
		{
			try
			{
				if (arguments != null)
				{
					arguments.setAllowFds(false);
				}
				return android.app.ActivityManagerNative.getDefault().startInstrumentation(className
					, profileFile, 0, arguments, null);
			}
			catch (android.os.RemoteException)
			{
			}
			// System has crashed, nothing we can do.
			return false;
		}
Exemplo n.º 5
0
		private void startIntentSenderForResultInner(android.content.IntentSender intent, 
			int requestCode, android.content.Intent fillInIntent, int flagsMask, int flagsValues
			, android.app.Activity activity)
		{
			try
			{
				string resolvedType = null;
				if (fillInIntent != null)
				{
					fillInIntent.setAllowFds(false);
					resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
				}
				int result = android.app.ActivityManagerNative.getDefault().startActivityIntentSender
					(mMainThread.getApplicationThread(), intent, fillInIntent, resolvedType, mToken, 
					activity.mEmbeddedID, requestCode, flagsMask, flagsValues);
				if (result == android.app.IActivityManagerClass.START_CANCELED)
				{
					throw new android.content.IntentSender.SendIntentException();
				}
				android.app.Instrumentation.checkStartActivityResult(result, null);
			}
			catch (android.os.RemoteException)
			{
			}
			if (requestCode >= 0)
			{
				mStartedActivity = true;
			}
		}
Exemplo n.º 6
0
		public override bool bindService(android.content.Intent service, android.content.ServiceConnection
			 conn, int flags)
		{
			android.app.IServiceConnection sd;
			if (mPackageInfo != null)
			{
				sd = mPackageInfo.getServiceDispatcher(conn, getOuterContext(), mMainThread.getHandler
					(), flags);
			}
			else
			{
				throw new java.lang.RuntimeException("Not supported in system context");
			}
			try
			{
				android.os.IBinder token = getActivityToken();
				if (token == null && (flags & BIND_AUTO_CREATE) == 0 && mPackageInfo != null && mPackageInfo
					.getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH)
				{
					flags |= BIND_WAIVE_PRIORITY;
				}
				service.setAllowFds(false);
				int res = android.app.ActivityManagerNative.getDefault().bindService(mMainThread.
					getApplicationThread(), getActivityToken(), service, service.resolveTypeIfNeeded
					(getContentResolver()), sd, flags);
				if (res < 0)
				{
					throw new System.Security.SecurityException("Not allowed to bind to service " + service
						);
				}
				return res != 0;
			}
			catch (android.os.RemoteException)
			{
				return false;
			}
		}
Exemplo n.º 7
0
		public override bool stopService(android.content.Intent service)
		{
			try
			{
				service.setAllowFds(false);
				int res = android.app.ActivityManagerNative.getDefault().stopService(mMainThread.
					getApplicationThread(), service, service.resolveTypeIfNeeded(getContentResolver(
					)));
				if (res < 0)
				{
					throw new System.Security.SecurityException("Not allowed to stop service " + service
						);
				}
				return res != 0;
			}
			catch (android.os.RemoteException)
			{
				return false;
			}
		}
Exemplo n.º 8
0
		public override android.content.ComponentName startService(android.content.Intent
			 service)
		{
			try
			{
				service.setAllowFds(false);
				android.content.ComponentName cn = android.app.ActivityManagerNative.getDefault()
					.startService(mMainThread.getApplicationThread(), service, service.resolveTypeIfNeeded
					(getContentResolver()));
				if (cn != null && cn.getPackageName().Equals("!"))
				{
					throw new System.Security.SecurityException("Not allowed to start service " + service
						 + " without permission " + cn.getClassName());
				}
				return cn;
			}
			catch (android.os.RemoteException)
			{
				return null;
			}
		}
Exemplo n.º 9
0
		public override void sendStickyBroadcast(android.content.Intent intent)
		{
			string resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
			try
			{
				intent.setAllowFds(false);
				android.app.ActivityManagerNative.getDefault().broadcastIntent(mMainThread.getApplicationThread
					(), intent, resolvedType, null, android.app.Activity.RESULT_OK, null, null, null
					, false, true);
			}
			catch (android.os.RemoteException)
			{
			}
		}
Exemplo n.º 10
0
		public override void startIntentSender(android.content.IntentSender intent, android.content.Intent
			 fillInIntent, int flagsMask, int flagsValues, int extraFlags)
		{
			try
			{
				string resolvedType = null;
				if (fillInIntent != null)
				{
					fillInIntent.setAllowFds(false);
					resolvedType = fillInIntent.resolveTypeIfNeeded(getContentResolver());
				}
				int result = android.app.ActivityManagerNative.getDefault().startActivityIntentSender
					(mMainThread.getApplicationThread(), intent, fillInIntent, resolvedType, null, null
					, 0, flagsMask, flagsValues);
				if (result == android.app.IActivityManagerClass.START_CANCELED)
				{
					throw new android.content.IntentSender.SendIntentException();
				}
				android.app.Instrumentation.checkStartActivityResult(result, null);
			}
			catch (android.os.RemoteException)
			{
			}
		}