Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06b9abf0 authored by Almaz Mingaleev's avatar Almaz Mingaleev Committed by Gerrit Code Review
Browse files

Merge "Clean-up after TZUvA feature removal."

parents bc0e3945 69a5f7df
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -238,7 +238,7 @@ package android {
    field public static final String PROVIDE_TRUST_AGENT = "android.permission.PROVIDE_TRUST_AGENT";
    field public static final String PROVISION_DEMO_DEVICE = "android.permission.PROVISION_DEMO_DEVICE";
    field public static final String QUERY_ADMIN_POLICY = "android.permission.QUERY_ADMIN_POLICY";
    field public static final String QUERY_TIME_ZONE_RULES = "android.permission.QUERY_TIME_ZONE_RULES";
    field @Deprecated public static final String QUERY_TIME_ZONE_RULES = "android.permission.QUERY_TIME_ZONE_RULES";
    field public static final String QUERY_USERS = "android.permission.QUERY_USERS";
    field public static final String RADIO_SCAN_WITHOUT_LOCATION = "android.permission.RADIO_SCAN_WITHOUT_LOCATION";
    field public static final String READ_ACTIVE_EMERGENCY_SESSION = "android.permission.READ_ACTIVE_EMERGENCY_SESSION";
@@ -340,7 +340,7 @@ package android {
    field public static final String UPDATE_DOMAIN_VERIFICATION_USER_SELECTION = "android.permission.UPDATE_DOMAIN_VERIFICATION_USER_SELECTION";
    field public static final String UPDATE_FONTS = "android.permission.UPDATE_FONTS";
    field public static final String UPDATE_LOCK = "android.permission.UPDATE_LOCK";
    field public static final String UPDATE_TIME_ZONE_RULES = "android.permission.UPDATE_TIME_ZONE_RULES";
    field @Deprecated public static final String UPDATE_TIME_ZONE_RULES = "android.permission.UPDATE_TIME_ZONE_RULES";
    field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
    field public static final String USER_ACTIVITY = "android.permission.USER_ACTIVITY";
    field public static final String USE_COLORIZED_NOTIFICATIONS = "android.permission.USE_COLORIZED_NOTIFICATIONS";
+0 −8
Original line number Diff line number Diff line
@@ -44,7 +44,6 @@ import android.app.smartspace.SmartspaceManager;
import android.app.time.TimeManager;
import android.app.timedetector.TimeDetector;
import android.app.timedetector.TimeDetectorImpl;
import android.app.timezone.RulesManager;
import android.app.timezonedetector.TimeZoneDetector;
import android.app.timezonedetector.TimeZoneDetectorImpl;
import android.app.trust.TrustManager;
@@ -1267,13 +1266,6 @@ public final class SystemServiceRegistry {
            }
        });

        registerService(Context.TIME_ZONE_RULES_MANAGER_SERVICE, RulesManager.class,
                new CachedServiceFetcher<RulesManager>() {
            @Override
            public RulesManager createService(ContextImpl ctx) {
                return new RulesManager(ctx.getOuterContext());
            }});

        registerService(Context.CROSS_PROFILE_APPS_SERVICE, CrossProfileApps.class,
                new CachedServiceFetcher<CrossProfileApps>() {
                    @Override
+0 −80
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.timezone;

import android.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Callback interface for receiving information about an async time zone operation.
 * The methods will be called on your application's main thread.
 *
 * @hide
 */
public abstract class Callback {

    @Retention(RetentionPolicy.SOURCE)
    @IntDef(prefix = { "SUCCESS", "ERROR_" }, value = {
            SUCCESS,
            ERROR_UNKNOWN_FAILURE,
            ERROR_INSTALL_BAD_DISTRO_STRUCTURE,
            ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION,
            ERROR_INSTALL_RULES_TOO_OLD,
            ERROR_INSTALL_VALIDATION_ERROR
    })
    public @interface AsyncResultCode {}

    /**
     * Indicates that an operation succeeded.
     */
    public static final int SUCCESS = 0;

    /**
     * Indicates an install / uninstall did not fully succeed for an unknown reason.
     */
    public static final int ERROR_UNKNOWN_FAILURE = 1;

    /**
     * Indicates an install failed because of a structural issue with the provided distro,
     * e.g. it wasn't in the right format or the contents were structured incorrectly.
     */
    public static final int ERROR_INSTALL_BAD_DISTRO_STRUCTURE = 2;

    /**
     * Indicates an install failed because of a versioning issue with the provided distro,
     * e.g. it was created for a different version of Android.
     */
    public static final int ERROR_INSTALL_BAD_DISTRO_FORMAT_VERSION = 3;

    /**
     * Indicates an install failed because the rules provided are too old for the device,
     * e.g. the Android device shipped with a newer rules version.
     */
    public static final int ERROR_INSTALL_RULES_TOO_OLD = 4;

    /**
     * Indicates an install failed because the distro contents failed validation.
     */
    public static final int ERROR_INSTALL_VALIDATION_ERROR = 5;

    /**
     * Reports the result of an async time zone operation.
     */
    public abstract void onFinished(@AsyncResultCode int status);
}
+0 −120
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.timezone;

import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Versioning information about a distro's format or a device's supported format.
 *
 * <p>The following properties are included:
 * <dl>
 *     <dt>majorVersion</dt>
 *     <dd>the major distro format version. Major versions differences are not compatible - e.g.
 *     2 is not compatible with 1 or 3.</dd>
 *     <dt>minorVersion</dt>
 *     <dd>the minor distro format version. Minor versions should be backwards compatible iff the
 *     major versions match exactly, i.e. version 2.2 will be compatible with 2.1 devices but not
 *     2.3 devices.</dd>
 * </dl>
 *
 * @hide
 */
public final class DistroFormatVersion implements Parcelable {

    private final int mMajorVersion;
    private final int mMinorVersion;

    public DistroFormatVersion(int majorVersion, int minorVersion) {
        mMajorVersion = Utils.validateVersion("major", majorVersion);
        mMinorVersion = Utils.validateVersion("minor", minorVersion);
    }

    public static final @android.annotation.NonNull Creator<DistroFormatVersion> CREATOR = new Creator<DistroFormatVersion>() {
        public DistroFormatVersion createFromParcel(Parcel in) {
            int majorVersion = in.readInt();
            int minorVersion = in.readInt();
            return new DistroFormatVersion(majorVersion, minorVersion);
        }

        public DistroFormatVersion[] newArray(int size) {
            return new DistroFormatVersion[size];
        }
    };

    public int getMajorVersion() {
        return mMajorVersion;
    }

    public int getMinorVersion() {
        return mMinorVersion;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeInt(mMajorVersion);
        out.writeInt(mMinorVersion);
    }

    /**
     * If this object describes a device's supported version and the parameter describes a distro's
     * version, this method returns whether the device would accept the distro.
     */
    public boolean supports(DistroFormatVersion distroFormatVersion) {
        return mMajorVersion == distroFormatVersion.mMajorVersion
                && mMinorVersion <= distroFormatVersion.mMinorVersion;
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DistroFormatVersion that = (DistroFormatVersion) o;

        if (mMajorVersion != that.mMajorVersion) {
            return false;
        }
        return mMinorVersion == that.mMinorVersion;
    }

    @Override
    public int hashCode() {
        int result = mMajorVersion;
        result = 31 * result + mMinorVersion;
        return result;
    }

    @Override
    public String toString() {
        return "DistroFormatVersion{"
                + "mMajorVersion=" + mMajorVersion
                + ", mMinorVersion=" + mMinorVersion
                + '}';
    }
}
+0 −132
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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.timezone;

import static android.app.timezone.Utils.validateRulesVersion;
import static android.app.timezone.Utils.validateVersion;

import android.annotation.Nullable;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Versioning information about a set of time zone rules.
 *
 * <p>The following properties are included:
 * <dl>
 *     <dt>rulesVersion</dt>
 *     <dd>the IANA rules version. e.g. "2017a"</dd>
 *     <dt>revision</dt>
 *     <dd>the revision for the rules. Allows there to be several revisions for a given IANA rules
 *     release. Numerically higher is newer.</dd>
 * </dl>
 *
 * @hide
 */
public final class DistroRulesVersion implements Parcelable {

    private final String mRulesVersion;
    private final int mRevision;

    public DistroRulesVersion(String rulesVersion, int revision) {
        mRulesVersion = validateRulesVersion("rulesVersion", rulesVersion);
        mRevision = validateVersion("revision", revision);
    }

    public static final @android.annotation.NonNull Creator<DistroRulesVersion> CREATOR = new Creator<DistroRulesVersion>() {
        public DistroRulesVersion createFromParcel(Parcel in) {
            String rulesVersion = in.readString();
            int revision = in.readInt();
            return new DistroRulesVersion(rulesVersion, revision);
        }

        public DistroRulesVersion[] newArray(int size) {
            return new DistroRulesVersion[size];
        }
    };

    public String getRulesVersion() {
        return mRulesVersion;
    }

    public int getRevision() {
        return mRevision;
    }

    /**
     * Returns true if this DistroRulesVersion is older than the one supplied. It returns false if
     * it is the same or newer. This method compares the {@code rulesVersion} and the
     * {@code revision}.
     */
    public boolean isOlderThan(DistroRulesVersion distroRulesVersion) {
        int rulesComparison = mRulesVersion.compareTo(distroRulesVersion.mRulesVersion);
        if (rulesComparison < 0) {
            return true;
        }
        if (rulesComparison > 0) {
            return false;
        }
        return mRevision < distroRulesVersion.mRevision;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeString(mRulesVersion);
        out.writeInt(mRevision);
    }

    @Override
    public boolean equals(@Nullable Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        DistroRulesVersion that = (DistroRulesVersion) o;

        if (mRevision != that.mRevision) {
            return false;
        }
        return mRulesVersion.equals(that.mRulesVersion);
    }

    @Override
    public int hashCode() {
        int result = mRulesVersion.hashCode();
        result = 31 * result + mRevision;
        return result;
    }

    @Override
    public String toString() {
        return "DistroRulesVersion{"
                + "mRulesVersion='" + mRulesVersion + '\''
                + ", mRevision='" + mRevision + '\''
                + '}';
    }

    public String toDumpString() {
        return mRulesVersion + "," + mRevision;
    }
}
Loading