Loading core/java/android/app/Profile.java +42 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.media.AudioManager; import android.os.Parcel; import android.os.ParcelUuid; import android.os.Parcelable; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -77,6 +79,8 @@ public final class Profile implements Parcelable, Comparable { private int mScreenLockMode = LockMode.DEFAULT; private int mExpandedDesktopMode = ExpandedDesktopMode.DEFAULT; /** @hide */ public static class LockMode { public static final int DEFAULT = 0; Loading @@ -84,6 +88,13 @@ public final class Profile implements Parcelable, Comparable { public static final int DISABLE = 2; } /** @hide */ public static class ExpandedDesktopMode { public static final int DEFAULT = 0; public static final int ENABLE = 1; public static final int DISABLE = 2; } /** @hide */ public static class TriggerType { public static final int WIFI = 0; Loading Loading @@ -346,6 +357,7 @@ public final class Profile implements Parcelable, Comparable { dest.writeParcelable(mAirplaneMode, flags); dest.writeInt(mScreenLockMode); dest.writeMap(mTriggers); dest.writeInt(mExpandedDesktopMode); } /** @hide */ Loading Loading @@ -379,6 +391,7 @@ public final class Profile implements Parcelable, Comparable { mAirplaneMode = (AirplaneModeSettings) in.readParcelable(null); mScreenLockMode = in.readInt(); in.readMap(mTriggers, null); mExpandedDesktopMode = in.readInt(); } public String getName() { Loading Loading @@ -466,6 +479,20 @@ public final class Profile implements Parcelable, Comparable { mDirty = true; } public int getExpandedDesktopMode() { return mExpandedDesktopMode; } public void setExpandedDesktopMode(int expandedDesktopMode) { if (expandedDesktopMode < ExpandedDesktopMode.DEFAULT || expandedDesktopMode > ExpandedDesktopMode.DISABLE) { mExpandedDesktopMode = ExpandedDesktopMode.DEFAULT; } else { mExpandedDesktopMode = expandedDesktopMode; } mDirty = true; } public AirplaneModeSettings getAirplaneMode() { return mAirplaneMode; } Loading Loading @@ -538,6 +565,10 @@ public final class Profile implements Parcelable, Comparable { builder.append(mScreenLockMode); builder.append("</screen-lock-mode>\n"); builder.append("<expanded-desktop-mode>"); builder.append(mExpandedDesktopMode); builder.append("</expanded-desktop-mode>\n"); mAirplaneMode.getXmlString(builder, context); mRingMode.getXmlString(builder, context); Loading Loading @@ -669,6 +700,9 @@ public final class Profile implements Parcelable, Comparable { if (name.equals("screen-lock-mode")) { profile.setScreenLockMode(Integer.valueOf(xpp.nextText())); } if (name.equals("expanded-desktop-mode")) { profile.setExpandedDesktopMode(Integer.valueOf(xpp.nextText())); } if (name.equals("profileGroup")) { ProfileGroup pg = ProfileGroup.fromXml(xpp, context); profile.addProfileGroup(pg); Loading Loading @@ -713,6 +747,14 @@ public final class Profile implements Parcelable, Comparable { mRingMode.processOverride(context); // Set airplane mode mAirplaneMode.processOverride(context); // Set expanded desktop if (mExpandedDesktopMode != ExpandedDesktopMode.DEFAULT) { Settings.System.putIntForUser(context.getContentResolver(), Settings.System.EXPANDED_DESKTOP_STATE, mExpandedDesktopMode == ExpandedDesktopMode.ENABLE ? 1 : 0, UserHandle.USER_CURRENT); } } /** @hide */ Loading Loading
core/java/android/app/Profile.java +42 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ import android.media.AudioManager; import android.os.Parcel; import android.os.ParcelUuid; import android.os.Parcelable; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; Loading Loading @@ -77,6 +79,8 @@ public final class Profile implements Parcelable, Comparable { private int mScreenLockMode = LockMode.DEFAULT; private int mExpandedDesktopMode = ExpandedDesktopMode.DEFAULT; /** @hide */ public static class LockMode { public static final int DEFAULT = 0; Loading @@ -84,6 +88,13 @@ public final class Profile implements Parcelable, Comparable { public static final int DISABLE = 2; } /** @hide */ public static class ExpandedDesktopMode { public static final int DEFAULT = 0; public static final int ENABLE = 1; public static final int DISABLE = 2; } /** @hide */ public static class TriggerType { public static final int WIFI = 0; Loading Loading @@ -346,6 +357,7 @@ public final class Profile implements Parcelable, Comparable { dest.writeParcelable(mAirplaneMode, flags); dest.writeInt(mScreenLockMode); dest.writeMap(mTriggers); dest.writeInt(mExpandedDesktopMode); } /** @hide */ Loading Loading @@ -379,6 +391,7 @@ public final class Profile implements Parcelable, Comparable { mAirplaneMode = (AirplaneModeSettings) in.readParcelable(null); mScreenLockMode = in.readInt(); in.readMap(mTriggers, null); mExpandedDesktopMode = in.readInt(); } public String getName() { Loading Loading @@ -466,6 +479,20 @@ public final class Profile implements Parcelable, Comparable { mDirty = true; } public int getExpandedDesktopMode() { return mExpandedDesktopMode; } public void setExpandedDesktopMode(int expandedDesktopMode) { if (expandedDesktopMode < ExpandedDesktopMode.DEFAULT || expandedDesktopMode > ExpandedDesktopMode.DISABLE) { mExpandedDesktopMode = ExpandedDesktopMode.DEFAULT; } else { mExpandedDesktopMode = expandedDesktopMode; } mDirty = true; } public AirplaneModeSettings getAirplaneMode() { return mAirplaneMode; } Loading Loading @@ -538,6 +565,10 @@ public final class Profile implements Parcelable, Comparable { builder.append(mScreenLockMode); builder.append("</screen-lock-mode>\n"); builder.append("<expanded-desktop-mode>"); builder.append(mExpandedDesktopMode); builder.append("</expanded-desktop-mode>\n"); mAirplaneMode.getXmlString(builder, context); mRingMode.getXmlString(builder, context); Loading Loading @@ -669,6 +700,9 @@ public final class Profile implements Parcelable, Comparable { if (name.equals("screen-lock-mode")) { profile.setScreenLockMode(Integer.valueOf(xpp.nextText())); } if (name.equals("expanded-desktop-mode")) { profile.setExpandedDesktopMode(Integer.valueOf(xpp.nextText())); } if (name.equals("profileGroup")) { ProfileGroup pg = ProfileGroup.fromXml(xpp, context); profile.addProfileGroup(pg); Loading Loading @@ -713,6 +747,14 @@ public final class Profile implements Parcelable, Comparable { mRingMode.processOverride(context); // Set airplane mode mAirplaneMode.processOverride(context); // Set expanded desktop if (mExpandedDesktopMode != ExpandedDesktopMode.DEFAULT) { Settings.System.putIntForUser(context.getContentResolver(), Settings.System.EXPANDED_DESKTOP_STATE, mExpandedDesktopMode == ExpandedDesktopMode.ENABLE ? 1 : 0, UserHandle.USER_CURRENT); } } /** @hide */ Loading