android.content.pm.PathPermission Java Examples

The following examples show how to use android.content.pm.PathPermission. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProviderHelper.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
private static void printProviderInfo(ProviderInfo providerInfo, int i) {
    String name = providerInfo.name;
    String authority = providerInfo.authority;
    String readPermission = providerInfo.readPermission;
    String writePermission = providerInfo.writePermission;
    boolean grantUriPermissions = providerInfo.grantUriPermissions;
    boolean multiProcess = providerInfo.multiprocess;
    int initOrder = providerInfo.initOrder;
    PatternMatcher[] uriPermissionPatterns = providerInfo.uriPermissionPatterns;
    PathPermission[] pathPermissions = providerInfo.pathPermissions;
    Log.d(TAG, i + "==============");
    Log.d(TAG, "name:" + name);
    Log.d(TAG, "authority:" + authority);
    Log.d(TAG, "readPermission:" + readPermission);
    Log.d(TAG, "writePermission:" + writePermission);
    Log.d(TAG, "grantUriPermissions:" + grantUriPermissions);
    Log.d(TAG, "multiprocess:" + multiProcess);
    Log.d(TAG, "initOrder:" + initOrder);
    Log.d(TAG, "uriPermissionPatterns:" + Arrays.toString(uriPermissionPatterns));
    Log.d(TAG, "pathPermissions:" + Arrays.toString(pathPermissions));
    Log.d(TAG, "applicationInfo.packageName:" + providerInfo.applicationInfo.packageName);
    Log.d(TAG, "applicationInfo.name:" + providerInfo.applicationInfo.name);
    Log.d(TAG, i + "==============");
}
 
Example #2
Source File: PackageDetail.java    From Inspeckage with Apache License 2.0 5 votes vote down vote up
public String getExportedContentProvider() {
    StringBuilder sb = new StringBuilder();
    if (mPInfo.providers != null) {
        for (ProviderInfo pi : mPInfo.providers) {
            String piName = pi.name;
            if (pi.exported) {

                //Grant Uri Permissions
                piName = piName + " GRANT: " + String.valueOf(pi.grantUriPermissions) + "|";

                if (pi.authority != null) {
                    piName = piName + " AUTHORITY: " + pi.authority + "|";
                }

                if (pi.readPermission != null) {
                    piName = piName + " READ: " + pi.readPermission + "|";
                }
                if (pi.writePermission != null) {
                    piName = piName + " WRITE: " + pi.writePermission + "|";
                }
                PathPermission[] pp = pi.pathPermissions;
                if (pp != null) {
                    for (PathPermission pathPermission : pp) {
                        piName = piName + " PATH: " + pathPermission.getPath() + "|";
                        piName = piName + "  - READ: " + pathPermission.getReadPermission() + "|";
                        piName = piName + "  - WRITE: " + pathPermission.getWritePermission() + "|";
                    }
                }
                sb.append(piName + "\n");
            }
        }
    } else {
        sb.append(" -- null");
    }
    return sb.toString();
}
 
Example #3
Source File: PackageDetail.java    From Inspeckage with Apache License 2.0 5 votes vote down vote up
public String getNonExportedContentProvider() {
    StringBuilder sb = new StringBuilder();
    if (mPInfo.providers != null) {
        for (ProviderInfo pi : mPInfo.providers) {
            String piName = pi.name;
            if (!pi.exported) {

                //Grant Uri Permissions
                piName = piName + " GRANT: " + String.valueOf(pi.grantUriPermissions) + "|";

                if (pi.authority != null) {
                    piName = piName + " AUTHORITY: " + pi.authority + "|";
                }

                if (pi.readPermission != null) {
                    piName = piName + " READ: " + pi.readPermission + "|";
                }
                if (pi.writePermission != null) {
                    piName = piName + " WRITE: " + pi.writePermission + "|";
                }
                PathPermission[] pp = pi.pathPermissions;
                if (pp != null) {
                    for (PathPermission pathPermission : pp) {
                        piName = piName + " PATH: " + pathPermission.getPath() + "|";
                        piName = piName + "  - READ: " + pathPermission.getReadPermission() + "|";
                        piName = piName + "  - WRITE: " + pathPermission.getWritePermission() + "|";
                    }
                }
                sb.append(piName + "\n");
            }
        }
    } else {
        sb.append(" -- null");
    }
    return sb.toString();
}
 
Example #4
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor just for mocking.
 *
 * @param context A Context object which should be some mock instance (like the
 * instance of {@link android.test.mock.MockContext}).
 * @param readPermission The read permision you want this instance should have in the
 * test, which is available via {@link #getReadPermission()}.
 * @param writePermission The write permission you want this instance should have
 * in the test, which is available via {@link #getWritePermission()}.
 * @param pathPermissions The PathPermissions you want this instance should have
 * in the test, which is available via {@link #getPathPermissions()}.
 * @hide
 */
public ContentProvider(
        Context context,
        String readPermission,
        String writePermission,
        PathPermission[] pathPermissions) {
    mContext = context;
    mReadPermission = readPermission;
    mWritePermission = writePermission;
    mPathPermissions = pathPermissions;
}
 
Example #5
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 3 votes vote down vote up
/**
 * Constructor just for mocking.
 *
 * @param context A Context object which should be some mock instance (like the
 * instance of {@link android.test.mock.MockContext}).
 * @param readPermission The read permision you want this instance should have in the
 * test, which is available via {@link #getReadPermission()}.
 * @param writePermission The write permission you want this instance should have
 * in the test, which is available via {@link #getWritePermission()}.
 * @param pathPermissions The PathPermissions you want this instance should have
 * in the test, which is available via {@link #getPathPermissions()}.
 * @hide
 */
public ContentProvider(
        Context context,
        String readPermission,
        String writePermission,
        PathPermission[] pathPermissions) {
    mContext = context;
    mReadPermission = readPermission;
    mWritePermission = writePermission;
    mPathPermissions = pathPermissions;
}
 
Example #6
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 2 votes vote down vote up
/**
 * Change the path-based permission required to read and/or write data in
 * the content provider.  This is normally set for you from its manifest
 * information when the provider is first created.
 *
 * @param permissions Array of path permission descriptions.
 */
protected final void setPathPermissions(@Nullable PathPermission[] permissions) {
    mPathPermissions = permissions;
}
 
Example #7
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 2 votes vote down vote up
/**
 * Return the path-based permissions required for read and/or write access to
 * this content provider.  This method can be called from multiple
 * threads, as described in
 * <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes
 * and Threads</a>.
 */
public final @Nullable PathPermission[] getPathPermissions() {
    return mPathPermissions;
}
 
Example #8
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Change the path-based permission required to read and/or write data in
 * the content provider.  This is normally set for you from its manifest
 * information when the provider is first created.
 *
 * @param permissions Array of path permission descriptions.
 */
protected final void setPathPermissions(@Nullable PathPermission[] permissions) {
    mPathPermissions = permissions;
}
 
Example #9
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Return the path-based permissions required for read and/or write access to
 * this content provider.  This method can be called from multiple
 * threads, as described in
 * <a href="{@docRoot}guide/topics/fundamentals/processes-and-threads.html#Threads">Processes
 * and Threads</a>.
 */
public final @Nullable PathPermission[] getPathPermissions() {
    return mPathPermissions;
}