Merge "Assorted renaming and repackaging"

This commit is contained in:
TreeHugger Robot
2020-11-09 18:35:30 +00:00
committed by Android (Google) Code Review
27 changed files with 73 additions and 69 deletions

View File

@@ -20,7 +20,7 @@ import android.content.Context;
import android.util.Log;
import com.android.internal.util.ConcurrentUtils;
import com.android.server.location.ContextHubService;
import com.android.server.location.contexthub.ContextHubService;
import java.util.concurrent.Future;

View File

@@ -33,8 +33,8 @@ import com.android.internal.R;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.os.BackgroundThread;
import com.android.internal.util.DumpUtils;
import com.android.server.location.ComprehensiveCountryDetector;
import com.android.server.location.CountryDetectorBase;
import com.android.server.location.countrydetector.ComprehensiveCountryDetector;
import com.android.server.location.countrydetector.CountryDetectorBase;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -43,10 +43,9 @@ import java.util.HashMap;
/**
* This class detects the country that the user is in. The default country detection is made through
* {@link com.android.server.location.ComprehensiveCountryDetector}. It is possible to overlay the
* detection algorithm by overlaying the attribute R.string.config_customCountryDetector with the
* custom class name to use instead. The custom class must extend
* {@link com.android.server.location.CountryDetectorBase}
* {@link ComprehensiveCountryDetector}. It is possible to overlay the detection algorithm by
* overlaying the attribute R.string.config_customCountryDetector with the custom class name to use
* instead. The custom class must extend {@link CountryDetectorBase}
*
* @hide
*/

View File

@@ -245,7 +245,7 @@ public class LocationManagerService extends ILocationManager.Stub {
// set up passive provider first since it will be required for all other location providers,
// which are loaded later once the system is ready.
mPassiveManager = new PassiveLocationProviderManager(mContext, injector);
addLocationProviderManager(mPassiveManager, new PassiveProvider(mContext));
addLocationProviderManager(mPassiveManager, new PassiveLocationProvider(mContext));
// TODO: load the gps provider here as well, which will require refactoring
@@ -320,7 +320,7 @@ public class LocationManagerService extends ILocationManager.Stub {
}
void onSystemThirdPartyAppsCanStart() {
LocationProviderProxy networkProvider = LocationProviderProxy.createAndRegister(
ProxyLocationProvider networkProvider = ProxyLocationProvider.createAndRegister(
mContext,
NETWORK_LOCATION_SERVICE_ACTION,
com.android.internal.R.bool.config_enableNetworkLocationOverlay,
@@ -339,7 +339,7 @@ public class LocationManagerService extends ILocationManager.Stub {
MATCH_DIRECT_BOOT_AWARE | MATCH_SYSTEM_ONLY, UserHandle.USER_SYSTEM).isEmpty(),
"Unable to find a direct boot aware fused location provider");
LocationProviderProxy fusedProvider = LocationProviderProxy.createAndRegister(
ProxyLocationProvider fusedProvider = ProxyLocationProvider.createAndRegister(
mContext,
FUSED_LOCATION_SERVICE_ACTION,
com.android.internal.R.bool.config_enableFusedLocationOverlay,
@@ -404,7 +404,7 @@ public class LocationManagerService extends ILocationManager.Stub {
Integer.parseInt(fragments[8]) /* powerRequirement */,
Integer.parseInt(fragments[9]) /* accuracy */);
getOrAddLocationProviderManager(name).setMockProvider(
new MockProvider(properties, CallerIdentity.fromContext(mContext)));
new MockLocationProvider(properties, CallerIdentity.fromContext(mContext)));
}
}
@@ -1037,7 +1037,7 @@ public class LocationManagerService extends ILocationManager.Stub {
}
getOrAddLocationProviderManager(provider).setMockProvider(
new MockProvider(properties, identity));
new MockLocationProvider(properties, identity));
}
@Override

View File

@@ -1312,7 +1312,7 @@ class LocationProviderManager extends
}
}
public void setMockProvider(@Nullable MockProvider provider) {
public void setMockProvider(@Nullable MockLocationProvider provider) {
synchronized (mLock) {
Preconditions.checkState(mState != STATE_STOPPED);

View File

@@ -34,11 +34,11 @@ import java.io.PrintWriter;
*
* {@hide}
*/
public class MockProvider extends AbstractLocationProvider {
public class MockLocationProvider extends AbstractLocationProvider {
@Nullable private Location mLocation;
public MockProvider(ProviderProperties properties, CallerIdentity identity) {
public MockLocationProvider(ProviderProperties properties, CallerIdentity identity) {
// using a direct executor is ok because this class has no locks that could deadlock
super(DIRECT_EXECUTOR, identity);
setProperties(properties);

View File

@@ -54,7 +54,7 @@ public class MockableLocationProvider extends AbstractLocationProvider {
@GuardedBy("mOwnerLock")
@Nullable private AbstractLocationProvider mRealProvider;
@GuardedBy("mOwnerLock")
@Nullable private MockProvider mMockProvider;
@Nullable private MockLocationProvider mMockProvider;
@GuardedBy("mOwnerLock")
private ProviderRequest mRequest;
@@ -113,7 +113,7 @@ public class MockableLocationProvider extends AbstractLocationProvider {
* inline invocation of {@link Listener#onStateChanged(State, State)} if this results in a
* state change.
*/
public void setMockProvider(@Nullable MockProvider provider) {
public void setMockProvider(@Nullable MockLocationProvider provider) {
synchronized (mOwnerLock) {
if (mMockProvider == provider) {
return;

View File

@@ -37,7 +37,7 @@ import java.io.PrintWriter;
*
* {@hide}
*/
public class PassiveProvider extends AbstractLocationProvider {
public class PassiveLocationProvider extends AbstractLocationProvider {
private static final ProviderProperties PROPERTIES = new ProviderProperties(
/* requiresNetwork = */false,
@@ -50,7 +50,7 @@ public class PassiveProvider extends AbstractLocationProvider {
Criteria.POWER_LOW,
Criteria.ACCURACY_COARSE);
public PassiveProvider(Context context) {
public PassiveLocationProvider(Context context) {
// using a direct executor is ok because this class has no locks that could deadlock
super(DIRECT_EXECUTOR, CallerIdentity.fromContext(context));

View File

@@ -36,12 +36,12 @@ class PassiveLocationProviderManager extends LocationProviderManager {
@Override
public void setRealProvider(AbstractLocationProvider provider) {
Preconditions.checkArgument(provider instanceof PassiveProvider);
Preconditions.checkArgument(provider instanceof PassiveLocationProvider);
super.setRealProvider(provider);
}
@Override
public void setMockProvider(@Nullable MockProvider provider) {
public void setMockProvider(@Nullable MockLocationProvider provider) {
if (provider != null) {
throw new IllegalArgumentException("Cannot mock the passive provider");
}
@@ -49,12 +49,12 @@ class PassiveLocationProviderManager extends LocationProviderManager {
public void updateLocation(Location location) {
synchronized (mLock) {
PassiveProvider passiveProvider = (PassiveProvider) mProvider.getProvider();
Preconditions.checkState(passiveProvider != null);
PassiveLocationProvider passive = (PassiveLocationProvider) mProvider.getProvider();
Preconditions.checkState(passive != null);
final long identity = Binder.clearCallingIdentity();
try {
passiveProvider.updateLocation(location);
passive.updateLocation(location);
} finally {
Binder.restoreCallingIdentity(identity);
}

View File

@@ -43,16 +43,16 @@ import java.util.Objects;
/**
* Proxy for ILocationProvider implementations.
*/
public class LocationProviderProxy extends AbstractLocationProvider {
public class ProxyLocationProvider extends AbstractLocationProvider {
/**
* Creates and registers this proxy. If no suitable service is available for the proxy, returns
* null.
*/
@Nullable
public static LocationProviderProxy createAndRegister(Context context, String action,
public static ProxyLocationProvider createAndRegister(Context context, String action,
int enableOverlayResId, int nonOverlayPackageResId) {
LocationProviderProxy proxy = new LocationProviderProxy(context, action, enableOverlayResId,
ProxyLocationProvider proxy = new ProxyLocationProvider(context, action, enableOverlayResId,
nonOverlayPackageResId);
if (proxy.register()) {
return proxy;
@@ -73,7 +73,7 @@ public class LocationProviderProxy extends AbstractLocationProvider {
private volatile ProviderRequest mRequest;
private LocationProviderProxy(Context context, String action, int enableOverlayResId,
private ProxyLocationProvider(Context context, String action, int enableOverlayResId,
int nonOverlayPackageResId) {
// safe to use direct executor since our locks are not acquired in a code path invoked by
// our owning provider

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2020 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.contexthub;
import java.util.concurrent.ConcurrentLinkedDeque;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
@@ -37,6 +37,8 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.proto.ProtoOutputStream;
import com.android.server.location.ClientBrokerProto;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Supplier;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import android.annotation.IntDef;
import android.app.PendingIntent;
@@ -29,6 +29,8 @@ import android.os.RemoteException;
import android.util.Log;
import android.util.proto.ProtoOutputStream;
import com.android.server.location.ClientManagerProto;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.DateFormat;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2016 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.contexthub;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
@@ -54,6 +54,7 @@ import android.util.Log;
import android.util.proto.ProtoOutputStream;
import com.android.internal.util.DumpUtils;
import com.android.server.location.ContextHubServiceProto;
import java.io.FileDescriptor;
import java.io.PrintWriter;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import android.hardware.location.ContextHubTransaction;
import android.hardware.location.NanoAppState;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import android.hardware.contexthub.V1_0.IContexthub;
import android.hardware.contexthub.V1_0.Result;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.contexthub;
import android.annotation.Nullable;
import android.hardware.contexthub.V1_1.Setting;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017 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.contexthub;
import android.annotation.Nullable;
import android.hardware.contexthub.V1_0.HubAppInfo;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 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.
@@ -11,10 +11,10 @@
* 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
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.countrydetector;
import android.content.Context;
import android.location.Country;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 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.
@@ -11,10 +11,10 @@
* 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
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.countrydetector;
import android.content.Context;
import android.location.Country;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 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.
@@ -11,10 +11,10 @@
* 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
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.countrydetector;
import android.content.Context;
import android.location.Address;

View File

@@ -152,7 +152,7 @@ public class LocationProviderManagerTest {
mPassive = new PassiveLocationProviderManager(mContext, mInjector);
mPassive.startManager();
mPassive.setRealProvider(new PassiveProvider(mContext));
mPassive.setRealProvider(new PassiveLocationProvider(mContext));
mProvider = new TestProvider(PROPERTIES, IDENTITY);
mProvider.setProviderAllowed(true);
@@ -308,7 +308,7 @@ public class LocationProviderManagerTest {
@Test
public void testGetLastLocation_ClearOnMockRemoval() {
MockProvider mockProvider = new MockProvider(PROPERTIES, IDENTITY);
MockLocationProvider mockProvider = new MockLocationProvider(PROPERTIES, IDENTITY);
mockProvider.setAllowed(true);
mManager.setMockProvider(mockProvider);

View File

@@ -50,7 +50,7 @@ public class MockableLocationProviderTest {
private ProviderListenerCapture mListener;
private AbstractLocationProvider mRealProvider;
private MockProvider mMockProvider;
private MockLocationProvider mMockProvider;
private MockableLocationProvider mProvider;
@@ -60,7 +60,7 @@ public class MockableLocationProviderTest {
mListener = new ProviderListenerCapture(lock);
mRealProvider = spy(new FakeProvider());
mMockProvider = spy(new MockProvider(new ProviderProperties(
mMockProvider = spy(new MockLocationProvider(new ProviderProperties(
false,
false,
false,

View File

@@ -35,8 +35,8 @@ import android.os.RemoteException;
import androidx.test.core.app.ApplicationProvider;
import com.android.internal.R;
import com.android.server.location.ComprehensiveCountryDetector;
import com.android.server.location.CustomCountryDetectorTestClass;
import com.android.server.location.countrydetector.ComprehensiveCountryDetector;
import com.android.server.location.countrydetector.CustomCountryDetectorTestClass;
import com.google.common.truth.Expect;
@@ -53,7 +53,7 @@ import org.mockito.junit.MockitoJUnitRunner;
public class CountryDetectorServiceTest {
private static final String VALID_CUSTOM_TEST_CLASS =
"com.android.server.location.CustomCountryDetectorTestClass";
"com.android.server.location.countrydetector.CustomCountryDetectorTestClass";
private static final String INVALID_CUSTOM_TEST_CLASS =
"com.android.server.location.MissingCountryDetectorTestClass";

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 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.
@@ -11,10 +11,10 @@
* 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
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.countrydetector;
import android.location.Country;
import android.location.CountryListener;

View File

@@ -1,5 +1,5 @@
/*
* 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.countrydetector;
import android.content.Context;
import android.location.Country;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 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.
@@ -11,9 +11,9 @@
* 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
* limitations under the License.
*/
package com.android.server.location;
package com.android.server.location.countrydetector;
import android.location.Country;
import android.location.CountryListener;