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

Commit 48a8baf8 authored by Sasha Kuznetsov's avatar Sasha Kuznetsov
Browse files

Move the various GNSS files into the gnss package + cleanup + javadocs

Bug: 150810542
Test: build and run cuttlefish
Change-Id: I7d966b3e26f1d5e5aadf0085d0d0bfe51b9dfc1a
parent db23a7e7
Loading
Loading
Loading
Loading
+0 −46
Original line number Diff line number Diff line
package com.android.server.location;

import java.util.Arrays;

/**
 * Represents a GNSS position mode.
 */
public class GnssPositionMode {
    private final int mode;
    private final int recurrence;
    private final int minInterval;
    private final int preferredAccuracy;
    private final int preferredTime;
    private final boolean lowPowerMode;

    public GnssPositionMode(int mode, int recurrence, int minInterval,
            int preferredAccuracy, int preferredTime, boolean lowPowerMode) {
        this.mode = mode;
        this.recurrence = recurrence;
        this.minInterval = minInterval;
        this.preferredAccuracy = preferredAccuracy;
        this.preferredTime = preferredTime;
        this.lowPowerMode = lowPowerMode;
    }

    @Override
    public boolean equals(Object other) {
        if (other instanceof GnssPositionMode) {
            GnssPositionMode that = (GnssPositionMode) other;
            return mode == that.mode && recurrence == that.recurrence
                    && minInterval == that.minInterval
                    && preferredAccuracy == that.preferredAccuracy
                    && preferredTime == that.preferredTime && lowPowerMode == that.lowPowerMode
                    && this.getClass() == that.getClass();
        }

        return false;
    }

    @Override
    public int hashCode() {
        return Arrays.hashCode(
                new Object[]{mode, recurrence, minInterval, preferredAccuracy, preferredTime,
                        lowPowerMode, getClass()});
    }
}
+17 −1
Original line number Diff line number Diff line
package com.android.server.location;
/*
 * 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 com.android.server.location.gnss;

/**
 * A simple implementation of exponential backoff.
+5 −3
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.server.location;
package com.android.server.location.gnss;

import android.location.GnssAntennaInfo;
import android.location.IGnssAntennaInfoListener;
@@ -23,8 +23,10 @@ import android.os.RemoteException;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.server.location.gnss.GnssListenerManager;
import com.android.server.location.gnss.GnssManagerService;
import com.android.server.location.AppForegroundHelper;
import com.android.server.location.AppOpsHelper;
import com.android.server.location.SettingsHelper;
import com.android.server.location.UserInfoHelper;

import java.util.List;

+19 −3
Original line number Diff line number Diff line
package com.android.server.location;
/*
 * 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 com.android.server.location.gnss;

import android.util.Log;

@@ -53,8 +69,8 @@ public class GnssBatchingProvider {
            throw new IllegalStateException();
        }
        if (periodNanos <= 0) {
            Log.e(TAG, "Invalid periodNanos " + periodNanos +
                    " in batching request, not started");
            Log.e(TAG, "Invalid periodNanos " + periodNanos
                    + " in batching request, not started");
            return false;
        }
        mStarted = mNative.startBatch(periodNanos, wakeOnFifoFull);
+3 −3
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 * 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.
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.server.location;
package com.android.server.location.gnss;

import android.location.GnssCapabilities;
import android.util.Log;
Loading