Loading core/api/system-current.txt +7 −4 Original line number Diff line number Diff line Loading @@ -1696,6 +1696,13 @@ package android.app.smartspace { package android.app.time { public final class Capabilities { field public static final int CAPABILITY_NOT_ALLOWED = 20; // 0x14 field public static final int CAPABILITY_NOT_APPLICABLE = 30; // 0x1e field public static final int CAPABILITY_NOT_SUPPORTED = 10; // 0xa field public static final int CAPABILITY_POSSESSED = 40; // 0x28 } public final class TimeManager { method @RequiresPermission(android.Manifest.permission.MANAGE_TIME_AND_ZONE_DETECTION) public void addTimeZoneDetectorListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.time.TimeManager.TimeZoneDetectorListener); method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_TIME_AND_ZONE_DETECTION) public android.app.time.TimeZoneCapabilitiesAndConfig getTimeZoneCapabilitiesAndConfig(); Loading @@ -1712,10 +1719,6 @@ package android.app.time { method public int getConfigureAutoDetectionEnabledCapability(); method public int getConfigureGeoDetectionEnabledCapability(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int CAPABILITY_NOT_ALLOWED = 20; // 0x14 field public static final int CAPABILITY_NOT_APPLICABLE = 30; // 0x1e field public static final int CAPABILITY_NOT_SUPPORTED = 10; // 0xa field public static final int CAPABILITY_POSSESSED = 40; // 0x28 field @NonNull public static final android.os.Parcelable.Creator<android.app.time.TimeZoneCapabilities> CREATOR; } Loading core/java/android/app/time/Capabilities.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; import android.annotation.IntDef; import android.annotation.SystemApi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * A capability is the ability for the user to configure something or perform an action. This * information is exposed so that system apps like SettingsUI can be dynamic, rather than * hard-coding knowledge of when configuration or actions are applicable / available to the user. * * <p>Capabilities have states that users cannot change directly. They may influence some * capabilities indirectly by agreeing to certain device-wide behaviors such as location sharing, or * by changing the configuration. See the {@code CAPABILITY_} constants for details. * * <p>Actions have associated methods, see the documentation for each action for details. * * <p>Note: Capabilities are independent of app permissions required to call the associated APIs. * * @hide */ @SystemApi public final class Capabilities { /** @hide */ @IntDef({ CAPABILITY_NOT_SUPPORTED, CAPABILITY_NOT_ALLOWED, CAPABILITY_NOT_APPLICABLE, CAPABILITY_POSSESSED }) @Retention(RetentionPolicy.SOURCE) public @interface CapabilityState {} /** * Indicates that a capability is not supported on this device, e.g. because of form factor or * hardware. The associated UI should usually not be shown to the user. */ public static final int CAPABILITY_NOT_SUPPORTED = 10; /** * Indicates that a capability is supported on this device, but not allowed for the user, e.g. * if the capability relates to the ability to modify settings the user is not able to. * This could be because of the user's type (e.g. maybe it applies to the primary user only) or * device policy. Depending on the capability, this could mean the associated UI * should be hidden, or displayed but disabled. */ public static final int CAPABILITY_NOT_ALLOWED = 20; /** * Indicates that a capability is possessed but not currently applicable, e.g. if the * capability relates to the ability to modify settings, the user has the ability to modify * it, but it is currently rendered irrelevant by other settings or other device state (flags, * resource config, etc.). The associated UI may be hidden, disabled, or left visible (but * ineffective) depending on requirements. */ public static final int CAPABILITY_NOT_APPLICABLE = 30; /** Indicates that a capability is possessed by the user. */ public static final int CAPABILITY_POSSESSED = 40; private Capabilities() {} } core/java/android/app/time/TimeCapabilities.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; parcelable TimeCapabilities; core/java/android/app/time/TimeCapabilities.java 0 → 100644 +186 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; import android.annotation.NonNull; import android.app.time.Capabilities.CapabilityState; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import java.util.Objects; /** * Time-relate capabilities for a user. * * <p>For configuration settings capabilities, the associated settings value can be found via * {@link TimeManager#getTimeCapabilitiesAndConfig()} and may be changed using {@link * TimeManager#updateTimeConfiguration(TimeConfiguration)} (if the user's capabilities * allow). * * @hide */ public final class TimeCapabilities implements Parcelable { public static final @NonNull Creator<TimeCapabilities> CREATOR = new Creator<TimeCapabilities>() { public TimeCapabilities createFromParcel(Parcel in) { return TimeCapabilities.createFromParcel(in); } public TimeCapabilities[] newArray(int size) { return new TimeCapabilities[size]; } }; /** * The user the capabilities are for. This is used for object equality and debugging but there * is no accessor. */ @NonNull private final UserHandle mUserHandle; private final @CapabilityState int mConfigureAutoTimeDetectionEnabledCapability; private final @CapabilityState int mSuggestTimeManuallyCapability; private TimeCapabilities(@NonNull Builder builder) { this.mUserHandle = Objects.requireNonNull(builder.mUserHandle); this.mConfigureAutoTimeDetectionEnabledCapability = builder.mConfigureAutoDetectionEnabledCapability; this.mSuggestTimeManuallyCapability = builder.mSuggestTimeManuallyCapability; } @NonNull private static TimeCapabilities createFromParcel(Parcel in) { UserHandle userHandle = UserHandle.readFromParcel(in); return new TimeCapabilities.Builder(userHandle) .setConfigureAutoTimeDetectionEnabledCapability(in.readInt()) .setSuggestTimeManuallyCapability(in.readInt()) .build(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { UserHandle.writeToParcel(mUserHandle, dest); dest.writeInt(mConfigureAutoTimeDetectionEnabledCapability); dest.writeInt(mSuggestTimeManuallyCapability); } /** * Returns the capability state associated with the user's ability to modify the automatic time * detection setting. */ @CapabilityState public int getConfigureAutoTimeDetectionEnabledCapability() { return mConfigureAutoTimeDetectionEnabledCapability; } /** * Returns the capability state associated with the user's ability to manually set time on a * device. */ @CapabilityState public int getSuggestTimeManuallyCapability() { return mSuggestTimeManuallyCapability; } @Override public int describeContents() { return 0; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TimeCapabilities that = (TimeCapabilities) o; return mConfigureAutoTimeDetectionEnabledCapability == that.mConfigureAutoTimeDetectionEnabledCapability && mSuggestTimeManuallyCapability == that.mSuggestTimeManuallyCapability && mUserHandle.equals(that.mUserHandle); } @Override public int hashCode() { return Objects.hash(mUserHandle, mConfigureAutoTimeDetectionEnabledCapability, mSuggestTimeManuallyCapability); } @Override public String toString() { return "TimeCapabilities{" + "mUserHandle=" + mUserHandle + ", mConfigureAutoTimeDetectionEnabledCapability=" + mConfigureAutoTimeDetectionEnabledCapability + ", mSuggestTimeManuallyCapability=" + mSuggestTimeManuallyCapability + '}'; } /** * A builder of {@link TimeCapabilities} objects. * * @hide */ public static class Builder { @NonNull private final UserHandle mUserHandle; private @CapabilityState int mConfigureAutoDetectionEnabledCapability; private @CapabilityState int mSuggestTimeManuallyCapability; public Builder(@NonNull TimeCapabilities timeCapabilities) { Objects.requireNonNull(timeCapabilities); this.mUserHandle = timeCapabilities.mUserHandle; this.mConfigureAutoDetectionEnabledCapability = timeCapabilities.mConfigureAutoTimeDetectionEnabledCapability; this.mSuggestTimeManuallyCapability = timeCapabilities.mSuggestTimeManuallyCapability; } public Builder(@NonNull UserHandle userHandle) { this.mUserHandle = Objects.requireNonNull(userHandle); } /** Sets the state for automatic time detection config. */ public Builder setConfigureAutoTimeDetectionEnabledCapability( @CapabilityState int setConfigureAutoTimeDetectionEnabledCapability) { this.mConfigureAutoDetectionEnabledCapability = setConfigureAutoTimeDetectionEnabledCapability; return this; } /** Sets the state for manual time change. */ public Builder setSuggestTimeManuallyCapability( @CapabilityState int suggestTimeManuallyCapability) { this.mSuggestTimeManuallyCapability = suggestTimeManuallyCapability; return this; } /** Returns the {@link TimeCapabilities}. */ public TimeCapabilities build() { verifyCapabilitySet(mConfigureAutoDetectionEnabledCapability, "configureAutoDetectionEnabledCapability"); verifyCapabilitySet(mSuggestTimeManuallyCapability, "suggestTimeManuallyCapability"); return new TimeCapabilities(this); } private void verifyCapabilitySet(int value, String name) { if (value == 0) { throw new IllegalStateException(name + " was not set"); } } } } core/java/android/app/time/TimeCapabilitiesAndConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; parcelable TimeCapabilitiesAndConfig; No newline at end of file Loading
core/api/system-current.txt +7 −4 Original line number Diff line number Diff line Loading @@ -1696,6 +1696,13 @@ package android.app.smartspace { package android.app.time { public final class Capabilities { field public static final int CAPABILITY_NOT_ALLOWED = 20; // 0x14 field public static final int CAPABILITY_NOT_APPLICABLE = 30; // 0x1e field public static final int CAPABILITY_NOT_SUPPORTED = 10; // 0xa field public static final int CAPABILITY_POSSESSED = 40; // 0x28 } public final class TimeManager { method @RequiresPermission(android.Manifest.permission.MANAGE_TIME_AND_ZONE_DETECTION) public void addTimeZoneDetectorListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.time.TimeManager.TimeZoneDetectorListener); method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_TIME_AND_ZONE_DETECTION) public android.app.time.TimeZoneCapabilitiesAndConfig getTimeZoneCapabilitiesAndConfig(); Loading @@ -1712,10 +1719,6 @@ package android.app.time { method public int getConfigureAutoDetectionEnabledCapability(); method public int getConfigureGeoDetectionEnabledCapability(); method public void writeToParcel(@NonNull android.os.Parcel, int); field public static final int CAPABILITY_NOT_ALLOWED = 20; // 0x14 field public static final int CAPABILITY_NOT_APPLICABLE = 30; // 0x1e field public static final int CAPABILITY_NOT_SUPPORTED = 10; // 0xa field public static final int CAPABILITY_POSSESSED = 40; // 0x28 field @NonNull public static final android.os.Parcelable.Creator<android.app.time.TimeZoneCapabilities> CREATOR; } Loading
core/java/android/app/time/Capabilities.java 0 → 100644 +78 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; import android.annotation.IntDef; import android.annotation.SystemApi; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * A capability is the ability for the user to configure something or perform an action. This * information is exposed so that system apps like SettingsUI can be dynamic, rather than * hard-coding knowledge of when configuration or actions are applicable / available to the user. * * <p>Capabilities have states that users cannot change directly. They may influence some * capabilities indirectly by agreeing to certain device-wide behaviors such as location sharing, or * by changing the configuration. See the {@code CAPABILITY_} constants for details. * * <p>Actions have associated methods, see the documentation for each action for details. * * <p>Note: Capabilities are independent of app permissions required to call the associated APIs. * * @hide */ @SystemApi public final class Capabilities { /** @hide */ @IntDef({ CAPABILITY_NOT_SUPPORTED, CAPABILITY_NOT_ALLOWED, CAPABILITY_NOT_APPLICABLE, CAPABILITY_POSSESSED }) @Retention(RetentionPolicy.SOURCE) public @interface CapabilityState {} /** * Indicates that a capability is not supported on this device, e.g. because of form factor or * hardware. The associated UI should usually not be shown to the user. */ public static final int CAPABILITY_NOT_SUPPORTED = 10; /** * Indicates that a capability is supported on this device, but not allowed for the user, e.g. * if the capability relates to the ability to modify settings the user is not able to. * This could be because of the user's type (e.g. maybe it applies to the primary user only) or * device policy. Depending on the capability, this could mean the associated UI * should be hidden, or displayed but disabled. */ public static final int CAPABILITY_NOT_ALLOWED = 20; /** * Indicates that a capability is possessed but not currently applicable, e.g. if the * capability relates to the ability to modify settings, the user has the ability to modify * it, but it is currently rendered irrelevant by other settings or other device state (flags, * resource config, etc.). The associated UI may be hidden, disabled, or left visible (but * ineffective) depending on requirements. */ public static final int CAPABILITY_NOT_APPLICABLE = 30; /** Indicates that a capability is possessed by the user. */ public static final int CAPABILITY_POSSESSED = 40; private Capabilities() {} }
core/java/android/app/time/TimeCapabilities.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; parcelable TimeCapabilities;
core/java/android/app/time/TimeCapabilities.java 0 → 100644 +186 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; import android.annotation.NonNull; import android.app.time.Capabilities.CapabilityState; import android.os.Parcel; import android.os.Parcelable; import android.os.UserHandle; import java.util.Objects; /** * Time-relate capabilities for a user. * * <p>For configuration settings capabilities, the associated settings value can be found via * {@link TimeManager#getTimeCapabilitiesAndConfig()} and may be changed using {@link * TimeManager#updateTimeConfiguration(TimeConfiguration)} (if the user's capabilities * allow). * * @hide */ public final class TimeCapabilities implements Parcelable { public static final @NonNull Creator<TimeCapabilities> CREATOR = new Creator<TimeCapabilities>() { public TimeCapabilities createFromParcel(Parcel in) { return TimeCapabilities.createFromParcel(in); } public TimeCapabilities[] newArray(int size) { return new TimeCapabilities[size]; } }; /** * The user the capabilities are for. This is used for object equality and debugging but there * is no accessor. */ @NonNull private final UserHandle mUserHandle; private final @CapabilityState int mConfigureAutoTimeDetectionEnabledCapability; private final @CapabilityState int mSuggestTimeManuallyCapability; private TimeCapabilities(@NonNull Builder builder) { this.mUserHandle = Objects.requireNonNull(builder.mUserHandle); this.mConfigureAutoTimeDetectionEnabledCapability = builder.mConfigureAutoDetectionEnabledCapability; this.mSuggestTimeManuallyCapability = builder.mSuggestTimeManuallyCapability; } @NonNull private static TimeCapabilities createFromParcel(Parcel in) { UserHandle userHandle = UserHandle.readFromParcel(in); return new TimeCapabilities.Builder(userHandle) .setConfigureAutoTimeDetectionEnabledCapability(in.readInt()) .setSuggestTimeManuallyCapability(in.readInt()) .build(); } @Override public void writeToParcel(@NonNull Parcel dest, int flags) { UserHandle.writeToParcel(mUserHandle, dest); dest.writeInt(mConfigureAutoTimeDetectionEnabledCapability); dest.writeInt(mSuggestTimeManuallyCapability); } /** * Returns the capability state associated with the user's ability to modify the automatic time * detection setting. */ @CapabilityState public int getConfigureAutoTimeDetectionEnabledCapability() { return mConfigureAutoTimeDetectionEnabledCapability; } /** * Returns the capability state associated with the user's ability to manually set time on a * device. */ @CapabilityState public int getSuggestTimeManuallyCapability() { return mSuggestTimeManuallyCapability; } @Override public int describeContents() { return 0; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TimeCapabilities that = (TimeCapabilities) o; return mConfigureAutoTimeDetectionEnabledCapability == that.mConfigureAutoTimeDetectionEnabledCapability && mSuggestTimeManuallyCapability == that.mSuggestTimeManuallyCapability && mUserHandle.equals(that.mUserHandle); } @Override public int hashCode() { return Objects.hash(mUserHandle, mConfigureAutoTimeDetectionEnabledCapability, mSuggestTimeManuallyCapability); } @Override public String toString() { return "TimeCapabilities{" + "mUserHandle=" + mUserHandle + ", mConfigureAutoTimeDetectionEnabledCapability=" + mConfigureAutoTimeDetectionEnabledCapability + ", mSuggestTimeManuallyCapability=" + mSuggestTimeManuallyCapability + '}'; } /** * A builder of {@link TimeCapabilities} objects. * * @hide */ public static class Builder { @NonNull private final UserHandle mUserHandle; private @CapabilityState int mConfigureAutoDetectionEnabledCapability; private @CapabilityState int mSuggestTimeManuallyCapability; public Builder(@NonNull TimeCapabilities timeCapabilities) { Objects.requireNonNull(timeCapabilities); this.mUserHandle = timeCapabilities.mUserHandle; this.mConfigureAutoDetectionEnabledCapability = timeCapabilities.mConfigureAutoTimeDetectionEnabledCapability; this.mSuggestTimeManuallyCapability = timeCapabilities.mSuggestTimeManuallyCapability; } public Builder(@NonNull UserHandle userHandle) { this.mUserHandle = Objects.requireNonNull(userHandle); } /** Sets the state for automatic time detection config. */ public Builder setConfigureAutoTimeDetectionEnabledCapability( @CapabilityState int setConfigureAutoTimeDetectionEnabledCapability) { this.mConfigureAutoDetectionEnabledCapability = setConfigureAutoTimeDetectionEnabledCapability; return this; } /** Sets the state for manual time change. */ public Builder setSuggestTimeManuallyCapability( @CapabilityState int suggestTimeManuallyCapability) { this.mSuggestTimeManuallyCapability = suggestTimeManuallyCapability; return this; } /** Returns the {@link TimeCapabilities}. */ public TimeCapabilities build() { verifyCapabilitySet(mConfigureAutoDetectionEnabledCapability, "configureAutoDetectionEnabledCapability"); verifyCapabilitySet(mSuggestTimeManuallyCapability, "suggestTimeManuallyCapability"); return new TimeCapabilities(this); } private void verifyCapabilitySet(int value, String name) { if (value == 0) { throw new IllegalStateException(name + " was not set"); } } } }
core/java/android/app/time/TimeCapabilitiesAndConfig.aidl 0 → 100644 +19 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.app.time; parcelable TimeCapabilitiesAndConfig; No newline at end of file