Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4f88008 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Application restrictions API" into jb-mr2-dev

parents 4deaf893 df2e92a5
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -846,6 +846,7 @@ package android {
    field public static final int reqNavigation = 16843306; // 0x101022a
    field public static final int reqTouchScreen = 16843303; // 0x1010227
    field public static final int required = 16843406; // 0x101028e
    field public static final int requiredForAllUsers = 16843728; // 0x10103d0
    field public static final int requiresFadingEdge = 16843685; // 0x10103a5
    field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
    field public static final int resizeMode = 16843619; // 0x1010363
@@ -5405,6 +5406,7 @@ package android.content {
    method public abstract java.lang.String[] fileList();
    method public abstract android.content.Context getApplicationContext();
    method public abstract android.content.pm.ApplicationInfo getApplicationInfo();
    method public java.util.List<android.content.RestrictionEntry> getApplicationRestrictions();
    method public abstract android.content.res.AssetManager getAssets();
    method public abstract java.io.File getCacheDir();
    method public abstract java.lang.ClassLoader getClassLoader();
@@ -5848,6 +5850,7 @@ package android.content {
    field public static final java.lang.String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
    field public static final java.lang.String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
    field public static final java.lang.String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
    field public static final java.lang.String ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES";
    field public static final java.lang.String ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED";
    field public static final java.lang.String ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED";
    field public static final java.lang.String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
@@ -5989,6 +5992,7 @@ package android.content {
    field public static final java.lang.String EXTRA_REFERRER = "android.intent.extra.REFERRER";
    field public static final java.lang.String EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token";
    field public static final java.lang.String EXTRA_REPLACING = "android.intent.extra.REPLACING";
    field public static final java.lang.String EXTRA_RESTRICTIONS = "android.intent.extra.restrictions";
    field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
@@ -6231,6 +6235,33 @@ package android.content {
    ctor public ReceiverCallNotAllowedException(java.lang.String);
  }
  public class RestrictionEntry implements android.os.Parcelable {
    ctor public RestrictionEntry(java.lang.String, java.lang.String);
    ctor public RestrictionEntry(java.lang.String, boolean);
    ctor public RestrictionEntry(java.lang.String, java.lang.String[]);
    ctor public RestrictionEntry(android.os.Parcel);
    method public int describeContents();
    method public boolean getBooleanValue();
    method public java.lang.String[] getMultipleValues();
    method public java.lang.String getStringValue();
    method public void setMultipleValues(java.lang.String[]);
    method public void setValue(java.lang.String);
    method public void setValue(boolean);
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.os.Parcelable.Creator CREATOR;
    field public static final int TYPE_BOOLEAN = 1; // 0x1
    field public static final int TYPE_CHOICE = 2; // 0x2
    field public static final int TYPE_CHOICE_LEVEL = 3; // 0x3
    field public static final int TYPE_MULTI_SELECT = 4; // 0x4
    field public static final int TYPE_NULL = 0; // 0x0
    field public java.lang.String[] choices;
    field public java.lang.String description;
    field public java.lang.String key;
    field public java.lang.String title;
    field public int type;
    field public java.lang.String[] values;
  }
  public class SearchRecentSuggestionsProvider extends android.content.ContentProvider {
    ctor public SearchRecentSuggestionsProvider();
    method public int delete(android.net.Uri, java.lang.String, java.lang.String[]);
+4 −1
Original line number Diff line number Diff line
@@ -152,6 +152,9 @@ public class AccountManager {
    public static final int ERROR_CODE_BAD_ARGUMENTS = 7;
    public static final int ERROR_CODE_BAD_REQUEST = 8;

    /** @hide */
    public static final int ERROR_CODE_USER_RESTRICTED = 100;

    /**
     * Bundle key used for the {@link String} account name in results
     * from methods which return information about a particular account.
@@ -1526,7 +1529,7 @@ public class AccountManager {
            }

            public void onError(int code, String message) {
                if (code == ERROR_CODE_CANCELED) {
                if (code == ERROR_CODE_CANCELED || code == ERROR_CODE_USER_RESTRICTED) {
                    // the authenticator indicated that this request was canceled, do so now
                    cancel(true /* mayInterruptIfRunning */);
                    return;
+8 −0
Original line number Diff line number Diff line
@@ -17,14 +17,17 @@
package android.app;

import java.util.ArrayList;
import java.util.List;

import android.content.ComponentCallbacks;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.Intent;
import android.content.RestrictionEntry;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.UserManager;

/**
 * Base class for those who need to maintain global application state. You can
@@ -131,6 +134,11 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 {
        }
    }

    public List<RestrictionEntry> getApplicationRestrictions() {
        return ((UserManager) getSystemService(USER_SERVICE))
                .getApplicationRestrictions(getPackageName(), android.os.Process.myUserHandle());
    }

    public void registerComponentCallbacks(ComponentCallbacks callback) {
        synchronized (mComponentCallbacks) {
            mComponentCallbacks.add(callback);
+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * Interface to global information about an application environment.  This is
@@ -285,6 +286,15 @@ public abstract class Context {
     */
    public abstract Context getApplicationContext();

    /**
     * Returns the list of restrictions for the application, or null if there are no
     * restrictions.
     * @return
     */
    public List<RestrictionEntry> getApplicationRestrictions() {
        return getApplicationContext().getApplicationRestrictions();
    }

    /**
     * Add a new {@link ComponentCallbacks} to the base application of the
     * Context, which will be called at the same times as the ComponentCallbacks
+15 −0
Original line number Diff line number Diff line
@@ -2414,6 +2414,15 @@ public class Intent implements Parcelable, Cloneable {
    public static final String ACTION_PRE_BOOT_COMPLETED =
            "android.intent.action.PRE_BOOT_COMPLETED";

    /**
     * Broadcast to a specific application to query any supported restrictions to impose
     * on restricted users. The response should contain an extra {@link #EXTRA_RESTRICTIONS}
     * which is of type <code>ArrayList&lt;RestrictionEntry&gt;</code>.
     * @see RestrictionEntry
     */
    public static final String ACTION_GET_RESTRICTION_ENTRIES =
            "android.intent.action.GET_RESTRICTION_ENTRIES";

    /**
     * Sent the first time a user is starting, to allow system apps to
     * perform one time initialization.  (This will not be seen by third
@@ -3146,6 +3155,12 @@ public class Intent implements Parcelable, Cloneable {
    public static final String EXTRA_USER_HANDLE =
            "android.intent.extra.user_handle";

    /**
     * Extra used in the response from a BroadcastReceiver that handles
     * {@link #ACTION_GET_RESTRICTION_ENTRIES}.
     */
    public static final String EXTRA_RESTRICTIONS = "android.intent.extra.restrictions";

    // ---------------------------------------------------------------------
    // ---------------------------------------------------------------------
    // Intent flags (see mFlags variable).
Loading