use of android.content.ComponentName in project VirtualApp by asLody.
the class GetServiceInfo method call.
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
ComponentName componentName = (ComponentName) args[0];
int flags = (int) args[1];
if ((flags & GET_DISABLED_COMPONENTS) == 0) {
flags |= GET_DISABLED_COMPONENTS;
}
int userId = VUserHandle.myUserId();
ServiceInfo info = VPackageManager.get().getServiceInfo(componentName, flags, userId);
if (info != null) {
return info;
}
info = (ServiceInfo) method.invoke(who, args);
if (info != null) {
if (getHostPkg().equals(info.packageName) || ComponentUtils.isSystemApp(info.applicationInfo)) {
return info;
}
}
return null;
}
use of android.content.ComponentName in project enroscar by stanfy.
the class SharingHelper method createSharingData.
private SharingData createSharingData(final Intent sharingIntent) {
final SharingData data = TextUtils.isEmpty(sharingIntent.getAction()) ? new PickData() : new SharingData();
data.intent = sharingIntent;
final Context context = this.context.get();
if (context instanceof Activity) {
data.callerInfo = ((Activity) context).getCallingActivity();
} else {
final String pkg = sharingIntent.getStringExtra(ShareCompat.EXTRA_CALLING_PACKAGE);
final String act = sharingIntent.getStringExtra(ShareCompat.EXTRA_CALLING_ACTIVITY);
if (!TextUtils.isEmpty(pkg) && !TextUtils.isEmpty(act)) {
data.callerInfo = new ComponentName(pkg, act);
}
}
return data;
}
use of android.content.ComponentName in project platform_frameworks_base by android.
the class VpnConfig method getIntentForConfirmation.
public static Intent getIntentForConfirmation() {
Intent intent = new Intent();
ComponentName componentName = ComponentName.unflattenFromString(Resources.getSystem().getString(com.android.internal.R.string.config_customVpnConfirmDialogComponent));
intent.setClassName(componentName.getPackageName(), componentName.getClassName());
return intent;
}
use of android.content.ComponentName in project platform_frameworks_base by android.
the class LifecycleTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
mTopIntent = mIntent;
mTabIntent = new Intent(mContext, LaunchpadTabActivity.class);
mTabIntent.putExtra("tab", new ComponentName(mContext, LaunchpadActivity.class));
}
use of android.content.ComponentName in project platform_frameworks_base by android.
the class LocalReceiver method onReceive.
public void onReceive(Context context, Intent intent) {
String resultString = LaunchpadActivity.RECEIVER_LOCAL;
if (BroadcastTest.BROADCAST_FAIL_REGISTER.equals(intent.getAction())) {
resultString = "Successfully registered, but expected it to fail";
try {
context.registerReceiver(this, new IntentFilter("foo.bar"));
context.unregisterReceiver(this);
} catch (ReceiverCallNotAllowedException e) {
//resultString = "This is the correct behavior but not yet implemented";
resultString = LaunchpadActivity.RECEIVER_LOCAL;
}
} else if (BroadcastTest.BROADCAST_FAIL_BIND.equals(intent.getAction())) {
resultString = "Successfully bound to service, but expected it to fail";
try {
ServiceConnection sc = new ServiceConnection() {
public void onServiceConnected(ComponentName name, IBinder service) {
}
public void onServiceDisconnected(ComponentName name) {
}
};
context.bindService(new Intent(context, LocalService.class), sc, 0);
context.unbindService(sc);
} catch (ReceiverCallNotAllowedException e) {
//resultString = "This is the correct behavior but not yet implemented";
resultString = LaunchpadActivity.RECEIVER_LOCAL;
}
} else if (LaunchpadActivity.BROADCAST_REPEAT.equals(intent.getAction())) {
Intent newIntent = new Intent(intent);
newIntent.setAction(LaunchpadActivity.BROADCAST_LOCAL);
context.sendOrderedBroadcast(newIntent, null);
}
try {
IBinder caller = intent.getIBinderExtra("caller");
Parcel data = Parcel.obtain();
data.writeInterfaceToken(LaunchpadActivity.LAUNCH);
data.writeString(resultString);
caller.transact(LaunchpadActivity.GOT_RECEIVE_TRANSACTION, data, null, 0);
data.recycle();
} catch (RemoteException ex) {
}
}
Aggregations