Android Open Source - permissions Application 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  ww w  .  ja va  2 s . c  om
import java.util.ArrayList;
import java.util.List;

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

/**
 * Stores information about an app.
 *    * the name (aka 'label') of the app
 *    * the app's icon's resource id
 *    * the app's package name
 *    * a List<Permission> of the requested permissions
 * @implements Parcelable
 */
public class ApplicationInfo implements Parcelable {

    private final int iconId;
    private final String name;
    private final String packageName;
    private final List<Permission> permissions;

    /**
     * standard constructor
     * @param appName the name (aka 'label') of the app
     * @param iconResourceId the app's icon's resource id
     * @param packageName the app's package name
     * @param permissions a list of the requested permissions
     */
    public ApplicationInfo(String appName, int iconResourceId, String packageName, List<Permission> permissions) {
        this.name = appName;
        this.iconId = iconResourceId;
        this.packageName = packageName;
        this.permissions = permissions;
    }

    /*
     * (non-Javadoc)
     * @see android.os.Parcelable.Creator<T>
     */
    public ApplicationInfo(Parcel parcel) {
        this.name = parcel.readString();
        this.packageName = parcel.readString();
        this.iconId = parcel.readInt();
        this.permissions = new ArrayList<Permission>();
        parcel.readTypedList(this.permissions, Permission.CREATOR);
    }


    /**
     * @return the app's icon's resource id
     */
    public int getIconResourceId() {
        return this.iconId;
    }
    /**
     * @return the app's name (aka 'label')
     */
    public String getName() {
        return this.name;
    }
    /**
     * @return the app's package name
     */
    public String getPackageName() {
        return this.packageName;
    }
    /**
     * @return a list of the requested permissions
     */
    public List<Permission> getPermissions() {
        return this.permissions;
    }


    /*
     * (non-Javadoc)
     * @see android.os.Parcelable#writeToParcel(android.os.Parcel, int)
     */
    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeString(this.name);
        parcel.writeString(this.packageName);
        parcel.writeInt(this.iconId);
        parcel.writeTypedList(this.permissions);
    }


    /*
     * (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<ApplicationInfo> CREATOR = new Parcelable.Creator<ApplicationInfo>() {
        /*
         * (non-Javadoc)
         * @see android.os.Parcelable.Creator#createFromParcel(android.os.Parcel)
         */
        @Override
        public ApplicationInfo createFromParcel(Parcel in) {
            return new ApplicationInfo(in);
        }
        /*
         * (non-Javadoc)
         * @see android.os.Parcelable.Creator#newArray(int)
         */
        @Override
        public ApplicationInfo[] newArray(int size) {
            return new ApplicationInfo[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