Пример #1
0
		public override java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions
			(android.content.ComponentName caller, android.content.Intent[] specifics, android.content.Intent
			 intent, int flags)
		{
			android.content.ContentResolver resolver = mContext.getContentResolver();
			string[] specificTypes = null;
			if (specifics != null)
			{
				int N = specifics.Length;
				{
					for (int i = 0; i < N; i++)
					{
						android.content.Intent sp = specifics[i];
						if (sp != null)
						{
							string t = sp.resolveTypeIfNeeded(resolver);
							if (t != null)
							{
								if (specificTypes == null)
								{
									specificTypes = new string[N];
								}
								specificTypes[i] = t;
							}
						}
					}
				}
			}
			try
			{
				return mPM.queryIntentActivityOptions(caller, specifics, specificTypes, intent, intent
					.resolveTypeIfNeeded(resolver), flags);
			}
			catch (android.os.RemoteException e)
			{
				throw new java.lang.RuntimeException("Package manager has died", e);
			}
		}
Пример #2
0
		public override java.util.List<android.content.pm.ResolveInfo> queryIntentServices
			(android.content.Intent intent, int flags)
		{
			try
			{
				return mPM.queryIntentServices(intent, intent.resolveTypeIfNeeded(mContext.getContentResolver
					()), flags);
			}
			catch (android.os.RemoteException e)
			{
				throw new java.lang.RuntimeException("Package manager has died", e);
			}
		}
Пример #3
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"
				);
		}
Пример #4
0
		public override android.content.pm.ResolveInfo resolveActivity(android.content.Intent
			 intent, int flags)
		{
			try
			{
				return mPM.resolveIntent(intent, intent.resolveTypeIfNeeded(mContext.getContentResolver
					()), flags);
			}
			catch (android.os.RemoteException e)
			{
				throw new java.lang.RuntimeException("Package manager has died", e);
			}
		}
Пример #5
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;
			}
		}
Пример #6
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;
			}
		}
Пример #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;
			}
		}
Пример #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;
			}
		}
Пример #9
0
		public override void removeStickyBroadcast(android.content.Intent intent)
		{
			string resolvedType = intent.resolveTypeIfNeeded(getContentResolver());
			if (resolvedType != null)
			{
				intent = new android.content.Intent(intent);
				intent.setDataAndType(intent.getData(), resolvedType);
			}
			try
			{
				intent.setAllowFds(false);
				android.app.ActivityManagerNative.getDefault().unbroadcastIntent(mMainThread.getApplicationThread
					(), intent);
			}
			catch (android.os.RemoteException)
			{
			}
		}
Пример #10
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)
			{
			}
		}
Пример #11
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)
			{
			}
		}