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

Commit 3c15b113 authored by Neil Fuller's avatar Neil Fuller
Browse files

Switch GnssTimeUpdateService to internal service

Switch GnssTimeUpdateService to calling TimeDetectorInternal, not
TimeDetectorService over AIDL.

TimeDetectorInternal was recently added for NetworkTimeUpdateService and
this commit follows the same pattern.

Bug: 219693030
Bug: 222295093
Test: atest services/tests/servicestests/src/com/android/server/timedetector/
Test: atest services/tests/servicestests/src/com/android/server/timezonedetector/
Test: atest core/tests/coretests/src/android/app/timedetector/
Change-Id: I916cf878469280e6c9498baf2cf930e140c3a386
parent f5316de4
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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.timedetector;

parcelable GnssTimeSuggestion;
+0 −2
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.app.time.ExternalTimeSuggestion;
import android.app.time.ITimeDetectorListener;
import android.app.time.TimeCapabilitiesAndConfig;
import android.app.time.TimeConfiguration;
import android.app.timedetector.GnssTimeSuggestion;
import android.app.timedetector.ManualTimeSuggestion;
import android.app.timedetector.TelephonyTimeSuggestion;
import android.app.timedetector.TimePoint;
@@ -46,7 +45,6 @@ interface ITimeDetectorService {
  boolean updateConfiguration(in TimeConfiguration timeConfiguration);

  void suggestExternalTime(in ExternalTimeSuggestion timeSuggestion);
  void suggestGnssTime(in GnssTimeSuggestion timeSuggestion);
  boolean suggestManualTime(in ManualTimeSuggestion timeSuggestion);
  void suggestTelephonyTime(in TelephonyTimeSuggestion timeSuggestion);

+0 −8
Original line number Diff line number Diff line
@@ -111,12 +111,4 @@ public interface TimeDetector {
     */
    @RequiresPermission(android.Manifest.permission.SUGGEST_MANUAL_TIME_AND_ZONE)
    boolean suggestManualTime(@NonNull ManualTimeSuggestion timeSuggestion);

    /**
     * Suggests the time according to a gnss time source.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.SET_TIME)
    void suggestGnssTime(GnssTimeSuggestion timeSuggestion);
}
+0 −12
Original line number Diff line number Diff line
@@ -62,16 +62,4 @@ public final class TimeDetectorImpl implements TimeDetector {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    public void suggestGnssTime(GnssTimeSuggestion timeSuggestion) {
        if (DEBUG) {
            Log.d(TAG, "suggestGnssTime called: " + timeSuggestion);
        }
        try {
            mITimeDetectorService.suggestGnssTime(timeSuggestion);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
}
+3 −29
Original line number Diff line number Diff line
@@ -14,11 +14,10 @@
 * limitations under the License.
 */

package android.app.timedetector;
package com.android.server.timedetector;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.app.timedetector.TimeSuggestionHelper;
import android.os.ShellCommand;
import android.os.TimestampedValue;

@@ -30,23 +29,8 @@ import java.util.Objects;
 * A time signal from a GNSS source.
 *
 * <p>See {@link TimeSuggestionHelper} for property information.
 *
 * @hide
 */
public final class GnssTimeSuggestion implements Parcelable {

    public static final @NonNull Creator<GnssTimeSuggestion> CREATOR =
            new Creator<GnssTimeSuggestion>() {
                public GnssTimeSuggestion createFromParcel(Parcel in) {
                    TimeSuggestionHelper helper = TimeSuggestionHelper.handleCreateFromParcel(
                            GnssTimeSuggestion.class, in);
                    return new GnssTimeSuggestion(helper);
                }

                public GnssTimeSuggestion[] newArray(int size) {
                    return new GnssTimeSuggestion[size];
                }
            };
public final class GnssTimeSuggestion {

    @NonNull private final TimeSuggestionHelper mTimeSuggestionHelper;

@@ -58,16 +42,6 @@ public final class GnssTimeSuggestion implements Parcelable {
        mTimeSuggestionHelper = Objects.requireNonNull(helper);
    }

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

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        mTimeSuggestionHelper.handleWriteToParcel(dest, flags);
    }

    @NonNull
    public TimestampedValue<Long> getUnixEpochTime() {
        return mTimeSuggestionHelper.getUnixEpochTime();
Loading