use of android.content.pm.ProviderInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AccountSyncSettings method addSyncStateSwitch.
private void addSyncStateSwitch(Account account, String authority, String packageName, int uid) {
SyncStateSwitchPreference item = (SyncStateSwitchPreference) getCachedPreference(authority);
if (item == null) {
item = new SyncStateSwitchPreference(getPrefContext(), account, authority, packageName, uid);
getPreferenceScreen().addPreference(item);
} else {
item.setup(account, authority, packageName, uid);
}
item.setPersistent(false);
final ProviderInfo providerInfo = getPackageManager().resolveContentProviderAsUser(authority, 0, mUserHandle.getIdentifier());
if (providerInfo == null) {
return;
}
CharSequence providerLabel = providerInfo.loadLabel(getPackageManager());
if (TextUtils.isEmpty(providerLabel)) {
Log.e(TAG, "Provider needs a label for authority '" + authority + "'");
return;
}
String title = getString(R.string.sync_item_title, providerLabel);
item.setTitle(title);
item.setKey(authority);
}
use of android.content.pm.ProviderInfo in project android_frameworks_base by ResurrectionRemix.
the class ActivityThread method installContentProviders.
private void installContentProviders(Context context, List<ProviderInfo> providers) {
final ArrayList<IActivityManager.ContentProviderHolder> results = new ArrayList<IActivityManager.ContentProviderHolder>();
for (ProviderInfo cpi : providers) {
if (DEBUG_PROVIDER) {
StringBuilder buf = new StringBuilder(128);
buf.append("Pub ");
buf.append(cpi.authority);
buf.append(": ");
buf.append(cpi.name);
Log.i(TAG, buf.toString());
}
IActivityManager.ContentProviderHolder cph = installProvider(context, null, cpi, false, /*noisy*/
true, /*noReleaseNeeded*/
true);
if (cph != null) {
cph.noReleaseNeeded = true;
results.add(cph);
}
}
try {
ActivityManagerNative.getDefault().publishContentProviders(getApplicationThread(), results);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
use of android.content.pm.ProviderInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class RunningServiceDetails method addProcessDetailsView.
void addProcessDetailsView(RunningState.ProcessItem pi, boolean isMain) {
addProcessesHeader();
ActiveDetail detail = new ActiveDetail();
View root = mInflater.inflate(R.layout.running_service_details_process, mAllDetails, false);
mAllDetails.addView(root);
detail.mRootView = root;
detail.mViewHolder = new RunningProcessesView.ViewHolder(root);
detail.mActiveItem = detail.mViewHolder.bind(mState, pi, mBuilder);
TextView description = (TextView) root.findViewById(R.id.comp_description);
if (pi.mUserId != UserHandle.myUserId()) {
// Processes for another user are all shown batched together; there is
// no reason to have a description.
description.setVisibility(View.GONE);
} else if (isMain) {
description.setText(R.string.main_running_process_description);
} else {
int textid = 0;
CharSequence label = null;
ActivityManager.RunningAppProcessInfo rpi = pi.mRunningProcessInfo;
final ComponentName comp = rpi.importanceReasonComponent;
// + " pid=" + rpi.importanceReasonPid + " comp=" + comp);
switch(rpi.importanceReasonCode) {
case ActivityManager.RunningAppProcessInfo.REASON_PROVIDER_IN_USE:
textid = R.string.process_provider_in_use_description;
if (rpi.importanceReasonComponent != null) {
try {
ProviderInfo prov = getActivity().getPackageManager().getProviderInfo(rpi.importanceReasonComponent, 0);
label = RunningState.makeLabel(getActivity().getPackageManager(), prov.name, prov);
} catch (NameNotFoundException e) {
}
}
break;
case ActivityManager.RunningAppProcessInfo.REASON_SERVICE_IN_USE:
textid = R.string.process_service_in_use_description;
if (rpi.importanceReasonComponent != null) {
try {
ServiceInfo serv = getActivity().getPackageManager().getServiceInfo(rpi.importanceReasonComponent, 0);
label = RunningState.makeLabel(getActivity().getPackageManager(), serv.name, serv);
} catch (NameNotFoundException e) {
}
}
break;
}
if (textid != 0 && label != null) {
description.setText(getActivity().getString(textid, label));
}
}
mActiveDetails.add(detail);
}
use of android.content.pm.ProviderInfo in project cornerstone by Onskreen.
the class ActivityManagerService method revokeUriPermission.
public void revokeUriPermission(IApplicationThread caller, Uri uri, int modeFlags) {
enforceNotIsolatedCaller("revokeUriPermission");
synchronized (this) {
final ProcessRecord r = getRecordForAppLocked(caller);
if (r == null) {
throw new SecurityException("Unable to find app for caller " + caller + " when revoking permission to uri " + uri);
}
if (uri == null) {
Slog.w(TAG, "revokeUriPermission: null uri");
return;
}
modeFlags &= (Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
if (modeFlags == 0) {
return;
}
final IPackageManager pm = AppGlobals.getPackageManager();
final String authority = uri.getAuthority();
ProviderInfo pi = null;
ContentProviderRecord cpr = mProviderMap.getProviderByName(authority, r.userId);
if (cpr != null) {
pi = cpr.info;
} else {
try {
pi = pm.resolveContentProvider(authority, PackageManager.GET_URI_PERMISSION_PATTERNS, r.userId);
} catch (RemoteException ex) {
}
}
if (pi == null) {
Slog.w(TAG, "No content provider found for permission revoke: " + uri.toSafeString());
return;
}
revokeUriPermissionLocked(r.uid, uri, modeFlags);
}
}
use of android.content.pm.ProviderInfo in project DroidPlugin by DroidPluginTeam.
the class MyActivityManagerService method selectStubProviderInfo.
@Override
public ProviderInfo selectStubProviderInfo(int callingPid, int callingUid, ProviderInfo targetInfo) throws RemoteException {
runProcessGC();
//先从正在运行的进程中查找看是否有符合条件的进程,如果有则直接使用之
String stubProcessName1 = mRunningProcessList.getStubProcessByTarget(targetInfo);
if (stubProcessName1 != null) {
List<ProviderInfo> stubInfos = mStaticProcessList.getProviderInfoForProcessName(stubProcessName1);
for (ProviderInfo stubInfo : stubInfos) {
if (!mRunningProcessList.isStubInfoUsed(stubInfo)) {
mRunningProcessList.setTargetProcessName(stubInfo, targetInfo);
return stubInfo;
}
}
}
List<String> stubProcessNames = mStaticProcessList.getProcessNames();
for (String stubProcessName : stubProcessNames) {
List<ProviderInfo> stubInfos = mStaticProcessList.getProviderInfoForProcessName(stubProcessName);
if (mRunningProcessList.isProcessRunning(stubProcessName)) {
if (mRunningProcessList.isPkgEmpty(stubProcessName)) {
//空进程,没有运行任何插件包。
for (ProviderInfo stubInfo : stubInfos) {
if (!mRunningProcessList.isStubInfoUsed(stubInfo)) {
mRunningProcessList.setTargetProcessName(stubInfo, targetInfo);
return stubInfo;
}
}
throw throwException("没有找到合适的StubInfo");
} else if (mRunningProcessList.isPkgCanRunInProcess(targetInfo.packageName, stubProcessName, targetInfo.processName)) {
for (ProviderInfo stubInfo : stubInfos) {
if (!mRunningProcessList.isStubInfoUsed(stubInfo)) {
mRunningProcessList.setTargetProcessName(stubInfo, targetInfo);
return stubInfo;
}
}
throw throwException("没有找到合适的StubInfo");
} else {
//需要处理签名一样的情况。
}
} else {
for (ProviderInfo stubInfo : stubInfos) {
if (!mRunningProcessList.isStubInfoUsed(stubInfo)) {
mRunningProcessList.setTargetProcessName(stubInfo, targetInfo);
return stubInfo;
}
}
throw throwException("没有找到合适的StubInfo");
}
}
throw throwException("没有可用的进程了");
}
Aggregations