本文整理汇总了Java中android.os.RemoteException类的典型用法代码示例。如果您正苦于以下问题:Java RemoteException类的具体用法?Java RemoteException怎么用?Java RemoteException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemoteException类属于android.os包,在下文中一共展示了RemoteException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServiceConnected
import android.os.RemoteException; //导入依赖的package包/类
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
// Ignore this call if we disconnected in the meantime.
if (mContext == null) return;
mService = new Messenger(service);
mComponentName = name;
try {
Message registerClientMessage = Message.obtain(
null, REQUEST_REGISTER_CLIENT);
registerClientMessage.replyTo = mMessenger;
Bundle b = mGsaHelper.getBundleForRegisteringGSAClient(mContext);
registerClientMessage.setData(b);
registerClientMessage.getData().putString(
KEY_GSA_PACKAGE_NAME, mContext.getPackageName());
mService.send(registerClientMessage);
// Send prepare overlay message if there is a pending GSA context.
} catch (RemoteException e) {
Log.w(SERVICE_CONNECTION_TAG, "GSAServiceConnection - remote call failed", e);
}
}
示例2: acquireProviderClient
import android.os.RemoteException; //导入依赖的package包/类
@Override
public IBinder acquireProviderClient(int userId, ProviderInfo info) {
ProcessRecord callerApp;
synchronized (mPidsSelfLocked) {
callerApp = findProcessLocked(VBinder.getCallingPid());
}
if (callerApp == null) {
throw new SecurityException("Who are you?");
}
String processName = info.processName;
ProcessRecord r;
synchronized (this) {
r = startProcessIfNeedLocked(processName, userId, info.packageName);
}
if (r != null && r.client.asBinder().isBinderAlive()) {
try {
return r.client.acquireProviderClient(info);
} catch (RemoteException e) {
e.printStackTrace();
}
}
return null;
}
示例3: testMapParams
import android.os.RemoteException; //导入依赖的package包/类
@Test
public void testMapParams() throws RemoteException {
Map inList = new HashMap();
Map inOutList = new HashMap();
inList.put(1, 1);
inList.put(2, 2);
inOutList.put(5, 5);
inOutList.put(6, 6);
Map result = sampleService.testMap(inList, inOutList);
Log.i(TAG, "Map Result " + result);
Assert.assertEquals(3, result.size());
Assert.assertEquals(100, result.get("Result"));
Assert.assertEquals(4, inOutList.size());
Assert.assertEquals(1, inOutList.get(1));
Assert.assertEquals(2, inOutList.get(2));
}
示例4: resolveActivityInfo
import android.os.RemoteException; //导入依赖的package包/类
public ActivityInfo resolveActivityInfo(Intent intent, int flags) throws RemoteException {
try {
if (this.mApkManager == null) {
return null;
}
if (intent.getComponent() != null) {
return this.mApkManager.getActivityInfo(intent.getComponent(), flags);
}
ResolveInfo resolveInfo = this.mApkManager.resolveIntent(intent, intent.resolveTypeIfNeeded(this.mHostContext.getContentResolver()), flags);
if (resolveInfo == null || resolveInfo.activityInfo == null) {
return null;
}
return resolveInfo.activityInfo;
} catch (RemoteException e) {
JLog.log("wuxinrong", "获取ActivityInfo 失败 e=" + e.getMessage());
throw e;
} catch (Exception e2) {
JLog.log("wuxinrong", "获取ActivityInfo 失败 e=" + e2.getMessage());
return null;
}
}
示例5: resolveServiceInfo
import android.os.RemoteException; //导入依赖的package包/类
public ServiceInfo resolveServiceInfo(Intent intent, int flags) throws RemoteException {
try {
if (this.mApkManager == null) {
return null;
}
if (intent.getComponent() != null) {
return this.mApkManager.getServiceInfo(intent.getComponent(), flags);
}
ResolveInfo resolveInfo = this.mApkManager.resolveIntent(intent, intent.resolveTypeIfNeeded(this.mHostContext.getContentResolver()), flags);
if (resolveInfo == null || resolveInfo.serviceInfo == null) {
return null;
}
return resolveInfo.serviceInfo;
} catch (RemoteException e) {
JLog.log("wuxinrong", "获取ServiceInfo 失败 e=" + e.getMessage());
throw e;
} catch (Exception e2) {
JLog.log("wuxinrong", "获取ServiceInfo 失败 e=" + e2.getMessage());
return null;
}
}
示例6: releaseConnect
import android.os.RemoteException; //导入依赖的package包/类
private void releaseConnect(final boolean isLost) {
if (!isLost && this.service != null) {
try {
unregisterCallback(this.service, this.callback);
} catch (RemoteException e) {
e.printStackTrace();
}
}
if (FileDownloadLog.NEED_LOG) {
FileDownloadLog.d(this, "release connect resources %s", this.service);
}
this.service = null;
FileDownloadEventPool.getImpl().
asyncPublishInNewThread(new DownloadServiceConnectChangedEvent(
isLost ? DownloadServiceConnectChangedEvent.ConnectStatus.lost :
DownloadServiceConnectChangedEvent.ConnectStatus.disconnected,
serviceClass));
}
示例7: doActivate
import android.os.RemoteException; //导入依赖的package包/类
private void doActivate() {
try {
Collection<String> purchased = null;
uiHandler.sendEmptyMessageDelayed(MESSAGE_CHECK, DELAY);
synchronized (lock) {
if (mInApp != null && mInApp.isBillingSupported(VERSION, mPackageName, TYPE) == 0) {
Bundle inapp = mInApp.getPurchases(VERSION, mPackageName, TYPE, null);
purchased = checkPurchased(inapp);
}
}
uiHandler.removeMessages(MESSAGE_CHECK);
uiHandler.obtainMessage(MESSAGE_ACTIVATE, purchased).sendToTarget();
} catch (RemoteException e) {
Log.d(mTag, "Can't check Play", e);
}
}
示例8: cycleShuffle
import android.os.RemoteException; //导入依赖的package包/类
/**
* Cycles through the shuffle options.
*/
public static void cycleShuffle() {
try {
if (mService != null) {
switch (mService.getShuffleMode()) {
case MusicPlaybackService.SHUFFLE_NONE:
mService.setShuffleMode(MusicPlaybackService.SHUFFLE);
if (mService.getRepeatMode() == MusicPlaybackService.REPEAT_CURRENT) {
mService.setRepeatMode(MusicPlaybackService.REPEAT_ALL);
}
break;
case MusicPlaybackService.SHUFFLE:
mService.setShuffleMode(MusicPlaybackService.SHUFFLE_NONE);
break;
default:
break;
}
}
} catch (final RemoteException ignored) {
}
}
示例9: getReceiverIntentFilter
import android.os.RemoteException; //导入依赖的package包/类
public List<IntentFilter> getReceiverIntentFilter(ActivityInfo info) throws RemoteException {
try {
if (getAndCheckCallingPkg(info.packageName) != null) {
PluginPackageParser parser = (PluginPackageParser) this.mPluginCache.get(info.packageName);
if (parser != null) {
List<IntentFilter> filters = parser.getReceiverIntentFilter(info);
if (filters != null && filters.size() > 0) {
return new ArrayList(filters);
}
}
}
return new ArrayList(0);
} catch (Exception e) {
RemoteException remoteException = new RemoteException();
remoteException.setStackTrace(e.getStackTrace());
throw remoteException;
}
}
示例10: subscribe
import android.os.RemoteException; //导入依赖的package包/类
public void subscribe(@NonNull String parentId, Bundle options, @NonNull SubscriptionCallback callback) {
SubscriptionCallbackApi21 cb21 = new SubscriptionCallbackApi21(callback, options);
Subscription sub = (Subscription) this.mSubscriptions.get(parentId);
if (sub == null) {
sub = new Subscription();
this.mSubscriptions.put(parentId, sub);
}
sub.setCallbackForOptions(cb21, options);
if (!MediaBrowserCompatApi21.isConnected(this.mBrowserObj)) {
return;
}
if (options == null || this.mServiceBinderWrapper == null) {
MediaBrowserCompatApi21.subscribe(this.mBrowserObj, parentId, cb21.mSubscriptionCallbackObj);
return;
}
try {
this.mServiceBinderWrapper.addSubscription(parentId, options, this.mCallbacksMessenger);
} catch (RemoteException e) {
Log.i(MediaBrowserCompat.TAG, "Remote error subscribing media item: " + parentId);
}
}
示例11: onServiceConnected
import android.os.RemoteException; //导入依赖的package包/类
public void onServiceConnected(ComponentName classname, IBinder obj) {
mService = IMediaPlaybackService.Stub.asInterface(obj);
startPlayback();
try {
// Assume something is playing when the service says it is,
// but also if the audio ID is valid but the service is paused.
if (mService.getAudioId() >= 0 || mService.isPlaying()
|| mService.getPath() != null) {
// something is playing now, we're done
mRepeatButton.setVisibility(View.VISIBLE);
mShuffleButton.setVisibility(View.VISIBLE);
setRepeatButtonImage();
setShuffleButtonImage();
setPauseButtonImage();
return;
}
} catch (RemoteException ex) {
}
// Service is dead or not playing anything. If we got here as part
// of a "play this file" Intent, exit. Otherwise go to the Music
// app start screen.
if (getIntent().getData() == null) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClass(MediaLockscreenActivity.this,
OnlineActivity.class);
startActivity(intent);
}
finish();
}
示例12: deleteApplicationCacheFiles
import android.os.RemoteException; //导入依赖的package包/类
@Override
public void deleteApplicationCacheFiles(String packageName, IPackageDataObserver observer) throws RemoteException {
boolean success = false;
try {
if (TextUtils.isEmpty(packageName)) {
return;
}
PluginPackageParser parser = mPluginCache.get(packageName);
if (parser == null) {
return;
}
ApplicationInfo applicationInfo = parser.getApplicationInfo(0);
Utils.deleteDir(new File(applicationInfo.dataDir, "caches").getName());
success = true;
} catch (Exception e) {
handleException(e);
} finally {
if (observer != null) {
observer.onRemoveCompleted(packageName, success);
}
}
}
示例13: sendLocalBroadcast2Process
import android.os.RemoteException; //导入依赖的package包/类
/**
* 多进程使用, 将intent送到目标进程,对方将收到Local Broadcast广播
* <p>
* 只有当目标进程存活时才能将数据送达
* <p>
* 常驻进程通过Local Broadcast注册处理代码
*
* @param target 目标进程名
* @param intent Intent对象
*/
public static boolean sendLocalBroadcast2Process(Context c, String target, Intent intent) {
if (LOG) {
LogDebug.d(TAG, "sendLocalBroadcast2Process: target=" + target + " intent=" + intent);
}
if (TextUtils.isEmpty(target)) {
return false;
}
try {
PluginProcessMain.getPluginHost().sendIntent2Process(target, intent);
return true;
} catch (RemoteException e) {
if (LOGR) {
e.printStackTrace();
}
}
return false;
}
示例14: validateRemoteBundle
import android.os.RemoteException; //导入依赖的package包/类
/**
* Check that the @param bundle is valid, this includes scrubbing it for parameters that could
* cause the app to crash. If it is not valid, an error is logged and the request ignored.
* <p>
*
* @param rl the remote {@link ISaiyListener}
* @param bundle the bundle to check
* @return true if the bundle is acceptable
*/
public boolean validateRemoteBundle(final ISaiyListener rl, final Bundle bundle) throws RemoteException {
if (DEBUG) {
MyLog.i(CLS_NAME, "validateRemoteBundle");
}
if (bundle != null) {
bundle.setClassLoader(RequestParcel.class.getClassLoader());
if (UtilsBundle.isSuspicious(bundle)) {
MyLog.e("Remote Saiy Request", mContext.getString(ai.saiy.android.R.string.error_bundle_corrupt));
} else {
if (DEBUG) {
MyLog.i(CLS_NAME, "validateRemoteBundle: bundle valid");
}
return true;
}
} else {
MyLog.e("Remote Saiy Request", mContext.getString(ai.saiy.android.R.string.error_bundle_null));
}
rl.onError(Defaults.ERROR.ERROR_DEVELOPER.name(), Validation.ID_UNKNOWN);
return false;
}
示例15: onRemoteEvent
import android.os.RemoteException; //导入依赖的package包/类
@Override
public void onRemoteEvent(Bundle remoteData) {
android.os.Parcel data = android.os.Parcel.obtain();
android.os.Parcel reply = android.os.Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
if (remoteData != null) {
data.writeInt(1);
remoteData.writeToParcel(data, 0);
} else {
data.writeInt(0);
}
mRemote.transact(TRANSACTION_onRemoteEvent_0, data, reply, android.os.IBinder.FLAG_ONEWAY);
} catch (RemoteException re) {
throw new RuntimeException(re);
} finally {
reply.recycle();
data.recycle();
}
}