Android Open Source - permissions Permission Info






From Project

Back to project page permissions.

License

The source code is released under:

MIT License

If you think the Android project permissions listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.tellmas.android.permissions;
//from  w  w  w . j a v  a 2s  .  c  o m
import java.util.List;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Stores information about a permission:
 *    - a Permission object with the info about this permission
 *    - a List<ApplicationInfo> of the apps which request this permission
 * @implements Parcelable
 */
public class PermissionInfo implements Parcelable {

    private final Permission permission;
    private List<ApplicationInfo> apps;

    /**
     * standard constructor
     * @param permission Permission object
     * @param apps List of ApplicationInfo of the apps which use this permission
     */
    public PermissionInfo(Permission permission, List<ApplicationInfo> apps) {
        this.permission = permission;
        this.apps = apps;
    }


    /*
     * (non-Javadoc)
     * @see android.os.Parcelable.Creator<T>
     */
    public PermissionInfo(Parcel parcel) {
        this.permission = parcel.readParcelable(Permission.class.getClassLoader());
        parcel.readTypedList(this.apps, ApplicationInfo.CREATOR);
    }


    /**
     * @return the permission's name
     */
    public Permission getPermission() {
        return this.permission;
    }
    /**
     * @return a list of the apps which request this permission
     */
    public List<ApplicationInfo> getApps() {
        return this.apps;
    }


    /*
     * (non-Javadoc)
     * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
     */
    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeParcelable(this.permission, flags);
        parcel.writeTypedList(this.apps);
    }


    /*
     * (non-Javadoc)
     * @see android.os.Parcelable#describeContents()
     * @see http://stackoverflow.com/questions/4076946/parcelable-where-when-is-describecontents-used/4914799#4914799
     */
    @Override
    public int describeContents() {
        return 0;
    }


    /*
     * (non-Javadoc)
     * @see android.os.Parcelable.Creator<T>
     */
    public static final Parcelable.Creator<PermissionInfo> CREATOR = new Parcelable.Creator<PermissionInfo>() {
        /*
         * (non-Javadoc)
         * @see android.os.Parcelable.Creator#createFromParcel(android.os.Parcel)
         */
        @Override
        public PermissionInfo createFromParcel(Parcel in) {
            return new PermissionInfo(in);
        }
        /*
         * (non-Javadoc)
         * @see android.os.Parcelable.Creator#newArray(int)
         */
        @Override
        public PermissionInfo[] newArray(int size) {
            return new PermissionInfo[size];
        }
    };
}




Java Source Code List

com.tellmas.android.permissions.AppListExpandableListAdapter.java
com.tellmas.android.permissions.AppListFragment.java
com.tellmas.android.permissions.ApplicationInfoComparator.java
com.tellmas.android.permissions.ApplicationInfo.java
com.tellmas.android.permissions.GlobalDefines.java
com.tellmas.android.permissions.MainActivity.java
com.tellmas.android.permissions.PermListExpandableListAdapter.java
com.tellmas.android.permissions.PermListFragment.java
com.tellmas.android.permissions.PermissionInfoComparator.java
com.tellmas.android.permissions.PermissionInfo.java
com.tellmas.android.permissions.Permission.java