resolve merge conflicts of 130e0ade7b to stage-aosp-master
Bug: None Test: I solemnly swear I tested this conflict resolution. Change-Id: Ie8cfba397930a1bd5ec947f4834478bb629fa640 Merged-In: I19e5fbfefcf59e0b53b197ea8e9e3cb78439b4c4
This commit is contained in:
@@ -13,6 +13,7 @@ java_library_static {
|
|||||||
},
|
},
|
||||||
srcs: [
|
srcs: [
|
||||||
"java/**/*.java",
|
"java/**/*.java",
|
||||||
|
":platformcompat_aidl",
|
||||||
":dumpstate_aidl",
|
":dumpstate_aidl",
|
||||||
":idmap2_aidl",
|
":idmap2_aidl",
|
||||||
":installd_aidl",
|
":installd_aidl",
|
||||||
@@ -80,3 +81,11 @@ prebuilt_etc {
|
|||||||
name: "gps_debug.conf",
|
name: "gps_debug.conf",
|
||||||
src: "java/com/android/server/location/gps_debug.conf",
|
src: "java/com/android/server/location/gps_debug.conf",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filegroup {
|
||||||
|
name: "platformcompat_aidl",
|
||||||
|
srcs: [
|
||||||
|
"java/com/android/server/compat/IPlatformCompat.aidl",
|
||||||
|
],
|
||||||
|
path: "java",
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import android.util.LongSparseArray;
|
|||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
/**
|
/**
|
||||||
* This class maintains state relating to platform compatibility changes.
|
* This class maintains state relating to platform compatibility changes.
|
||||||
*
|
*
|
||||||
@@ -169,4 +170,22 @@ public final class CompatConfig {
|
|||||||
return overrideExists;
|
return overrideExists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dumps the current list of compatibility config information.
|
||||||
|
*
|
||||||
|
* @param pw The {@link PrintWriter} instance to which the information will be dumped.
|
||||||
|
*/
|
||||||
|
public void dumpConfig(PrintWriter pw) {
|
||||||
|
synchronized (mChanges) {
|
||||||
|
if (mChanges.size() == 0) {
|
||||||
|
pw.println("No compat overrides.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < mChanges.size(); ++i) {
|
||||||
|
CompatChange c = mChanges.valueAt(i);
|
||||||
|
pw.println(c.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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.compat;
|
||||||
|
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* System private API for talking with the PlatformCompat service.
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
interface IPlatformCompat
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reports that a compatibility change is affecting an app process now.
|
||||||
|
*
|
||||||
|
* <p>Note: for changes that are gated using {@link #isChangeEnabled(long, ApplicationInfo)},
|
||||||
|
* you do not need to call this API directly. The change will be reported for you in the case
|
||||||
|
* that {@link #isChangeEnabled(long, ApplicationInfo)} returns {@code true}.
|
||||||
|
*
|
||||||
|
* @param changeId The ID of the compatibility change taking effect.
|
||||||
|
* @param appInfo Representing the affected app.
|
||||||
|
*/
|
||||||
|
void reportChange(long changeId, in ApplicationInfo appInfo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query if a given compatibility change is enabled for an app process. This method should
|
||||||
|
* be called when implementing functionality on behalf of the affected app.
|
||||||
|
*
|
||||||
|
* <p>If this method returns {@code true}, the calling code should implement the compatibility
|
||||||
|
* change, resulting in differing behaviour compared to earlier releases. If this method returns
|
||||||
|
* {@code false}, the calling code should behave as it did in earlier releases.
|
||||||
|
*
|
||||||
|
* <p>When this method returns {@code true}, it will also report the change as
|
||||||
|
* {@link #reportChange(long, ApplicationInfo)} would, so there is no need to call that method
|
||||||
|
* directly.
|
||||||
|
*
|
||||||
|
* @param changeId The ID of the compatibility change in question.
|
||||||
|
* @param appInfo Representing the app in question.
|
||||||
|
* @return {@code true} if the change is enabled for the current app.
|
||||||
|
*/
|
||||||
|
boolean isChangeEnabled(long changeId, in ApplicationInfo appInfo);
|
||||||
|
}
|
||||||
@@ -16,52 +16,46 @@
|
|||||||
|
|
||||||
package com.android.server.compat;
|
package com.android.server.compat;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
|
import com.android.internal.util.DumpUtils;
|
||||||
|
|
||||||
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System server internal API for gating and reporting compatibility changes.
|
* System server internal API for gating and reporting compatibility changes.
|
||||||
*/
|
*/
|
||||||
public class PlatformCompat {
|
public class PlatformCompat extends IPlatformCompat.Stub {
|
||||||
|
|
||||||
private static final String TAG = "Compatibility";
|
private static final String TAG = "Compatibility";
|
||||||
|
|
||||||
/**
|
private final Context mContext;
|
||||||
* Reports that a compatibility change is affecting an app process now.
|
|
||||||
*
|
public PlatformCompat(Context context) {
|
||||||
* <p>Note: for changes that are gated using {@link #isChangeEnabled(long, ApplicationInfo)},
|
mContext = context;
|
||||||
* you do not need to call this API directly. The change will be reported for you in the case
|
}
|
||||||
* that {@link #isChangeEnabled(long, ApplicationInfo)} returns {@code true}.
|
|
||||||
*
|
@Override
|
||||||
* @param changeId The ID of the compatibility change taking effect.
|
public void reportChange(long changeId, ApplicationInfo appInfo) {
|
||||||
* @param appInfo Representing the affected app.
|
|
||||||
*/
|
|
||||||
public static void reportChange(long changeId, ApplicationInfo appInfo) {
|
|
||||||
Slog.d(TAG, "Compat change reported: " + changeId + "; UID " + appInfo.uid);
|
Slog.d(TAG, "Compat change reported: " + changeId + "; UID " + appInfo.uid);
|
||||||
// TODO log via StatsLog
|
// TODO log via StatsLog
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Query if a given compatibility change is enabled for an app process. This method should
|
public boolean isChangeEnabled(long changeId, ApplicationInfo appInfo) {
|
||||||
* be called when implementing functionality on behalf of the affected app.
|
|
||||||
*
|
|
||||||
* <p>If this method returns {@code true}, the calling code should implement the compatibility
|
|
||||||
* change, resulting in differing behaviour compared to earlier releases. If this method returns
|
|
||||||
* {@code false}, the calling code should behave as it did in earlier releases.
|
|
||||||
*
|
|
||||||
* <p>When this method returns {@code true}, it will also report the change as
|
|
||||||
* {@link #reportChange(long, ApplicationInfo)} would, so there is no need to call that method
|
|
||||||
* directly.
|
|
||||||
*
|
|
||||||
* @param changeId The ID of the compatibility change in question.
|
|
||||||
* @param appInfo Representing the app in question.
|
|
||||||
* @return {@code true} if the change is enabled for the current app.
|
|
||||||
*/
|
|
||||||
public static boolean isChangeEnabled(long changeId, ApplicationInfo appInfo) {
|
|
||||||
if (CompatConfig.get().isChangeEnabled(changeId, appInfo)) {
|
if (CompatConfig.get().isChangeEnabled(changeId, appInfo)) {
|
||||||
reportChange(changeId, appInfo);
|
reportChange(changeId, appInfo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
|
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, "platform_compat", pw)) return;
|
||||||
|
CompatConfig.get().dumpConfig(pw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ import com.android.server.biometrics.iris.IrisService;
|
|||||||
import com.android.server.broadcastradio.BroadcastRadioService;
|
import com.android.server.broadcastradio.BroadcastRadioService;
|
||||||
import com.android.server.camera.CameraServiceProxy;
|
import com.android.server.camera.CameraServiceProxy;
|
||||||
import com.android.server.clipboard.ClipboardService;
|
import com.android.server.clipboard.ClipboardService;
|
||||||
|
import com.android.server.compat.PlatformCompat;
|
||||||
import com.android.server.connectivity.IpConnectivityMetrics;
|
import com.android.server.connectivity.IpConnectivityMetrics;
|
||||||
import com.android.server.contentcapture.ContentCaptureManagerInternal;
|
import com.android.server.contentcapture.ContentCaptureManagerInternal;
|
||||||
import com.android.server.coverage.CoverageService;
|
import com.android.server.coverage.CoverageService;
|
||||||
@@ -1089,6 +1090,11 @@ public final class SystemServer {
|
|||||||
traceBeginAndSlog("SignedConfigService");
|
traceBeginAndSlog("SignedConfigService");
|
||||||
SignedConfigService.registerUpdateReceiver(mSystemContext);
|
SignedConfigService.registerUpdateReceiver(mSystemContext);
|
||||||
traceEnd();
|
traceEnd();
|
||||||
|
|
||||||
|
traceBeginAndSlog("PlatformCompat");
|
||||||
|
ServiceManager.addService("platform_compat", new PlatformCompat(context));
|
||||||
|
traceEnd();
|
||||||
|
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
Slog.e("System", "******************************************");
|
Slog.e("System", "******************************************");
|
||||||
Slog.e("System", "************ Failure starting core service", e);
|
Slog.e("System", "************ Failure starting core service", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user