Home | History | Annotate | Download | only in admin
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.app.admin;
     18 
     19 import java.util.List;
     20 
     21 /**
     22  * Device policy manager local system service interface.
     23  *
     24  * @hide Only for use within the system server.
     25  */
     26 public abstract class DevicePolicyManagerInternal {
     27 
     28     /**
     29      * Listener for changes in the white-listed packages to show cross-profile
     30      * widgets.
     31      */
     32     public interface OnCrossProfileWidgetProvidersChangeListener {
     33 
     34         /**
     35          * Called when the white-listed packages to show cross-profile widgets
     36          * have changed for a given user.
     37          *
     38          * @param profileId The profile for which the white-listed packages changed.
     39          * @param packages The white-listed packages.
     40          */
     41         public void onCrossProfileWidgetProvidersChanged(int profileId, List<String> packages);
     42     }
     43 
     44     /**
     45      * Gets the packages whose widget providers are white-listed to be
     46      * available in the parent user.
     47      *
     48      * @param profileId The profile id.
     49      * @return The list of packages if such or empty list if there are
     50      *    no white-listed packages or the profile id is not a managed
     51      *    profile.
     52      */
     53     public abstract List<String> getCrossProfileWidgetProviders(int profileId);
     54 
     55     /**
     56      * Adds a listener for changes in the white-listed packages to show
     57      * cross-profile app widgets.
     58      *
     59      * @param listener The listener to add.
     60      */
     61     public abstract void addOnCrossProfileWidgetProvidersChangeListener(
     62             OnCrossProfileWidgetProvidersChangeListener listener);
     63 
     64     /**
     65      * Checks if an app with given uid is an active device admin of its user and has the policy
     66      * specified.
     67      * @param uid App uid.
     68      * @param reqPolicy Required policy, for policies see {@link DevicePolicyManager}.
     69      * @return true if the uid is an active admin with the given policy.
     70      */
     71     public abstract boolean isActiveAdminWithPolicy(int uid, int reqPolicy);
     72 }
     73