Merge "Move VPN restriction check into setup dialog" into nyc-dev
am: 32ceb9c801
* commit '32ceb9c801a86f901ec8230eec301c30e1deff3b':
Move VPN restriction check into setup dialog
Change-Id: I214e3196b6aca565ff0f45bbca1f92d6d97fc4d2
This commit is contained in:
@@ -25,6 +25,7 @@ import android.os.Bundle;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
|
import android.os.UserManager;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.Html.ImageGetter;
|
import android.text.Html.ImageGetter;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -55,6 +56,10 @@ public class ConfirmDialog extends AlertActivity
|
|||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (UserManager.get(this).hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
View view = View.inflate(this, R.layout.confirm, null);
|
View view = View.inflate(this, R.layout.confirm, null);
|
||||||
((TextView) view.findViewById(R.id.warning)).setText(
|
((TextView) view.findViewById(R.id.warning)).setText(
|
||||||
Html.fromHtml(getString(R.string.warning, getVpnLabel()),
|
Html.fromHtml(getString(R.string.warning, getVpnLabel()),
|
||||||
|
|||||||
@@ -555,8 +555,7 @@ public class Vpn {
|
|||||||
try {
|
try {
|
||||||
// Restricted users are not allowed to create VPNs, they are tied to Owner
|
// Restricted users are not allowed to create VPNs, they are tied to Owner
|
||||||
UserInfo user = mgr.getUserInfo(mUserHandle);
|
UserInfo user = mgr.getUserInfo(mUserHandle);
|
||||||
if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
|
if (user.isRestricted()) {
|
||||||
new UserHandle(mUserHandle))) {
|
|
||||||
throw new SecurityException("Restricted users cannot establish VPNs");
|
throw new SecurityException("Restricted users cannot establish VPNs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user