Skip to content

Commit 63e7cac

Browse files
author
android-build-team Robot
committed
Snap for 4824268 from e160b7a07e023db50b93dd7d4853c875ca8d8f7a to ub-testdpc-pic-release
Change-Id: I4c3bc217a13fd0b6b5c6a32c10ae3e9d5378ddaf
2 parents 079998e + b2a8be5 commit 63e7cac

File tree

10 files changed

+59
-24
lines changed

10 files changed

+59
-24
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ ext {
1313
}
1414

1515
android {
16-
compileSdkVersion 'android-P'
16+
compileSdkVersion 28
1717
buildToolsVersion "28.0.0"
1818

1919
defaultConfig {
2020
applicationId "com.afwsamples.testdpc"
2121
minSdkVersion 21
22-
targetSdkVersion 'P'
22+
targetSdkVersion 28
2323
versionCode versionMajor * 1000 + versionMinor * 100 + versionBuild
2424
versionName "${versionMajor}.${versionMinor}.${versionBuild}"
2525
multiDexEnabled true

app/src/main/java/com/afwsamples/testdpc/common/BaseManageComponentFragment.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,15 @@ public void onNothingSelected(AdapterView<?> parent) {
8181
view.findViewById(R.id.reset_app).setOnClickListener(this);
8282
view.findViewById(R.id.add_new_row).setOnClickListener(this);
8383
view.findViewById(R.id.load_default_button).setOnClickListener(this);
84-
onSpinnerItemSelected((T) mManagedAppsSpinner.getSelectedItem());
8584
return view;
8685
}
8786

87+
@Override
88+
public void onActivityCreated(Bundle savedInstanceState) {
89+
super.onActivityCreated(savedInstanceState);
90+
onSpinnerItemSelected((T) mManagedAppsSpinner.getSelectedItem());
91+
}
92+
8893
protected abstract SpinnerAdapter createSpinnerAdapter();
8994

9095
protected abstract BaseAdapter createListAdapter();

app/src/main/java/com/afwsamples/testdpc/common/preference/DpcPreferenceHelper.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ public class DpcPreferenceHelper {
9393
* not yet assigned.
9494
*/
9595
private int getDeviceSdkInt() {
96-
if (BuildCompat.isAtLeastP()) {
97-
return Build.VERSION_CODES.CUR_DEVELOPMENT;
98-
}
9996
return Build.VERSION.SDK_INT;
10097
}
10198

@@ -220,10 +217,6 @@ public void disableIfConstraintsNotMet() {
220217
*/
221218
private CharSequence findConstraintViolation() {
222219
if (getDeviceSdkInt() < mMinSdkVersion) {
223-
// FIXME: Remove this special checking once P is out.
224-
if (mMinSdkVersion > 27) {
225-
return mContext.getString(R.string.requires_preview_release);
226-
}
227220
return mContext.getString(R.string.requires_android_api_level, mMinSdkVersion);
228221
}
229222

app/src/main/java/com/afwsamples/testdpc/policy/UserRestrictionsDisplayFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ private void constrainPerferences() {
145145
}
146146
for (String restriction: UserRestriction.PIC_PLUS_RESTRICTIONS) {
147147
DpcPreferenceBase pref = (DpcPreferenceBase) findPreference(restriction);
148-
// TODO: Replace the following version code with P when ready
149-
pref.setMinSdkVersion(Build.VERSION_CODES.CUR_DEVELOPMENT);
148+
pref.setMinSdkVersion(Build.VERSION_CODES.P);
150149
}
151150
for (String restriction : UserRestriction.PRIMARY_USER_ONLY_RESTRICTIONS) {
152151
DpcPreferenceBase pref = (DpcPreferenceBase) findPreference(restriction);

app/src/main/java/com/afwsamples/testdpc/policy/keyguard/LockScreenPolicyFragment.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ abstract static class Keys {
6969
static final String MAX_TIME_SCREEN_LOCK = "key_max_time_screen_lock";
7070
static final String MAX_TIME_SCREEN_LOCK_ALL = "key_max_time_screen_lock_aggregate";
7171

72+
static final String KEYGUARD_DISABLE_FACE = "keyguard_disable_face";
73+
static final String KEYGUARD_DISABLE_IRIS = "keyguard_disable_iris";
7274
static final String KEYGUARD_DISABLE_FINGERPRINT = "keyguard_disable_fingerprint";
7375
static final String KEYGUARD_DISABLE_REMOTE_INPUT = "keyguard_disable_remote_input";
7476
static final String KEYGUARD_DISABLE_SECURE_CAMERA = "keyguard_disable_secure_camera";
@@ -101,9 +103,15 @@ abstract static class Keys {
101103
KEYGUARD_FEATURES.put(Keys.KEYGUARD_DISABLE_TRUST_AGENTS,
102104
DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS);
103105

106+
KEYGUARD_FEATURES.put(Keys.KEYGUARD_DISABLE_FACE,
107+
DevicePolicyManager.KEYGUARD_DISABLE_FACE);
108+
104109
KEYGUARD_FEATURES.put(Keys.KEYGUARD_DISABLE_FINGERPRINT,
105110
DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT);
106111

112+
KEYGUARD_FEATURES.put(Keys.KEYGUARD_DISABLE_IRIS,
113+
DevicePolicyManager.KEYGUARD_DISABLE_IRIS);
114+
107115
KEYGUARD_FEATURES.put(Keys.KEYGUARD_DISABLE_REMOTE_INPUT,
108116
DevicePolicyManager.KEYGUARD_DISABLE_REMOTE_INPUT);
109117
}

app/src/main/java/com/afwsamples/testdpc/profilepolicy/permission/ManageAppPermissionsFragment.java

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
import android.view.ViewGroup;
3333
import android.widget.BaseAdapter;
3434

35+
import android.widget.TextView;
3536
import com.afwsamples.testdpc.DeviceAdminReceiver;
3637
import com.afwsamples.testdpc.R;
37-
import com.afwsamples.testdpc.common.BaseManageComponentFragment;
3838
import com.afwsamples.testdpc.common.ManageAppFragment;
3939

4040
import java.util.ArrayList;
@@ -50,6 +50,7 @@ public class ManageAppPermissionsFragment extends ManageAppFragment {
5050

5151
private DevicePolicyManager mDpm;
5252
private List<AppPermissionsArrayAdapter.AppPermission> mAppPermissions = new ArrayList<>();
53+
private TextView mAppPermissionsView;
5354

5455
@Override
5556
public void onCreate(Bundle savedInstanceState) {
@@ -64,6 +65,8 @@ public View onCreateView(LayoutInflater layoutInflater, ViewGroup container,
6465
view.findViewById(R.id.load_default_button).setVisibility(View.GONE);
6566
view.findViewById(R.id.add_new_row).setVisibility(View.GONE);
6667
view.findViewById(R.id.manage_app_button_container).setVisibility(View.GONE);
68+
mAppPermissionsView = view.findViewById(R.id.error_message);
69+
mAppPermissionsView.setText(R.string.app_permissions_empty);
6770
return view;
6871
}
6972

@@ -107,8 +110,7 @@ protected void onSpinnerItemSelected(ApplicationInfo appInfo) {
107110
permissionState);
108111
populatedPermissions.add(populatedPerm);
109112
}
110-
111-
loadAppPermissionsList(populatedPermissions);
113+
displayAppPermissions(populatedPermissions);
112114
}
113115
}
114116

@@ -129,12 +131,19 @@ protected BaseAdapter createListAdapter() {
129131
return new AppPermissionsArrayAdapter(getActivity(), 0, mAppPermissions);
130132
}
131133

132-
private void loadAppPermissionsList(
133-
List<AppPermissionsArrayAdapter.AppPermission> permissions) {
134-
if (permissions != null) {
135-
mAppPermissions.clear();
134+
/**
135+
* Displays the list of permissions for the selected app. If there are no permissions to
136+
* be displayed, a text view displays a message about this.
137+
*/
138+
private void displayAppPermissions(
139+
List<AppPermissionsArrayAdapter.AppPermission> permissions) {
140+
mAppPermissions.clear();
141+
if (permissions.isEmpty()) {
142+
mAppPermissionsView.setVisibility(View.VISIBLE);
143+
} else {
144+
mAppPermissionsView.setVisibility(View.GONE);
136145
mAppPermissions.addAll(permissions);
137-
mAdapter.notifyDataSetChanged();
138146
}
147+
mAdapter.notifyDataSetChanged();
139148
}
140149
}

app/src/main/res/layout/manage_apps.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ limitations under the License.
5050
android:layout_alignParentRight="true"
5151
android:text="@string/plus" />
5252

53+
<TextView
54+
android:id="@+id/error_message"
55+
android:layout_below="@id/header_view"
56+
android:layout_above="@+id/load_default_button"
57+
android:visibility="gone"
58+
android:layout_height="wrap_content"
59+
android:layout_width="match_parent"
60+
android:paddingTop="16dp"
61+
android:paddingBottom="4dp" />
62+
5363
<ListView
5464
android:id="@+id/app_list_view"
5565
android:layout_below="@id/header_view"

app/src/main/res/values/attrs.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
<enum name="N" value="24" />
2828
<enum name="O" value="26" />
2929
<enum name="O_MR1" value="27" />
30-
<enum name="P" value="10000" />
31-
<!-- Build.VERSION_CODES.CUR_DEVELOPMENT, fill in the sdk int once it is finalized -->
30+
<enum name="P" value="28" />
3231
</attr>
3332

3433
<!-- Constrain a preference to DO or PO admins. -->

app/src/main/res/values/strings.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<string name="set_up_device_owner">Set up device owner</string>
2424
<string name="set_up_management_header">Set up management</string>
2525
<string name="setup_management_message">This app is currently not the owner of this device or
26-
profile. Please select an option below and tap SET UP to set up appropriate management by this app.</string>
27-
<string name="setup_management_message_for_do">This app is currently set as device owner. Please select the options below and tap SET UP to create a profile managed by the same app</string>
26+
profile. Please select an option below and tap Next to set up appropriate management by this app.</string>
27+
<string name="setup_management_message_for_do">This app is currently set as device owner. Please select the options below and tap Next to create a profile managed by the same app</string>
2828
<string name="provisioning_not_possible">TestDPC isn\'t currently allowed to be set up as the profile or device owner.</string>
2929
<string name="provisioning_not_possible_for_do">TestDPC isn\'t currently allowed to create a managed profile.</string>
3030
<string name="exit">Exit</string>
@@ -797,13 +797,17 @@
797797
<string name="permission_default">Let user decide</string>
798798
<string name="permission_deny">Deny</string>
799799
<string name="manage_app_permissions">Manage app permissions</string>
800+
<!-- Message displayed when there are no apps permissions to show. -->
801+
<string name="app_permissions_empty">There are no permissions to display for this app.</string>
800802

801803
<!-- Keyguard features -->
802804
<string name="keyguard_features">Keyguard features</string>
803805
<string name="keyguard_disable_secure_camera">Disable secure camera</string>
804806
<string name="keyguard_disable_secure_notifications">Disable secure notifications</string>
805807
<string name="keyguard_disable_unredacted_notifications">Disable unredacted notifications</string>
806808
<string name="keyguard_disable_trust_agents">Disable trust agents</string>
809+
<string name="keyguard_disable_face">Disable face unlock</string>
810+
<string name="keyguard_disable_iris">Disable iris unlock</string>
807811
<string name="keyguard_disable_fingerprint">Disable fingerprint</string>
808812
<string name="keyguard_disable_remote_input">Disable text entry in secure keyguard screen</string>
809813

app/src/main/res/xml/lock_screen_preferences.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,18 @@
8686
android:key="keyguard_disable_trust_agents"
8787
android:title="@string/keyguard_disable_trust_agents"
8888
testdpc:minSdkVersion="L" />
89+
<com.afwsamples.testdpc.common.preference.DpcSwitchPreference
90+
android:key="keyguard_disable_face"
91+
android:title="@string/keyguard_disable_face"
92+
testdpc:minSdkVersion="P" />
8993
<com.afwsamples.testdpc.common.preference.DpcSwitchPreference
9094
android:key="keyguard_disable_fingerprint"
9195
android:title="@string/keyguard_disable_fingerprint"
9296
testdpc:minSdkVersion="L" />
97+
<com.afwsamples.testdpc.common.preference.DpcSwitchPreference
98+
android:key="keyguard_disable_iris"
99+
android:title="@string/keyguard_disable_iris"
100+
testdpc:minSdkVersion="P" />
93101
<com.afwsamples.testdpc.common.preference.DpcSwitchPreference
94102
android:key="keyguard_disable_remote_input"
95103
android:title="@string/keyguard_disable_remote_input"

0 commit comments

Comments
 (0)