Merge changes I3f66d4ac,Id9867590,I38026ed8,I27ae1b24,I6497aeb2, ... into rvc-dev

* changes:
  Grant GPU access to mediacodec
  Grant GPU access to cameraserver
  Grant GPU access to hal_camera_default
  Grant GPU access to mediaserver
  Grant GPU access to ephemeral_app
  Grant GPU access to mediaswcodec
diff --git a/common/libs/device_config/host_device_config.cpp b/common/libs/device_config/host_device_config.cpp
index ba95845..5359a06 100644
--- a/common/libs/device_config/host_device_config.cpp
+++ b/common/libs/device_config/host_device_config.cpp
@@ -45,18 +45,20 @@
   std::string ril_broadcast;
 
   bool ObtainConfig(const std::string& interface) {
-    bool ret = ParseIntefaceAttributes(interface);
-    LOG(INFO) << "Network config:";
-    LOG(INFO) << "ipaddr = " << ril_ipaddr;
-    LOG(INFO) << "gateway = " << ril_gateway;
-    LOG(INFO) << "dns = " << ril_dns;
-    LOG(INFO) << "broadcast = " << ril_broadcast;
-    LOG(INFO) << "prefix length = " << static_cast<int>(ril_prefixlen);
+    bool ret = ParseInterfaceAttributes(interface);
+    if (ret) {
+      LOG(INFO) << "Network config:";
+      LOG(INFO) << "ipaddr = " << ril_ipaddr;
+      LOG(INFO) << "gateway = " << ril_gateway;
+      LOG(INFO) << "dns = " << ril_dns;
+      LOG(INFO) << "broadcast = " << ril_broadcast;
+      LOG(INFO) << "prefix length = " << static_cast<int>(ril_prefixlen);
+    }
     return ret;
   }
 
  private:
-  bool ParseIntefaceAttributes(struct ifaddrs* ifa) {
+  bool ParseInterfaceAttributes(struct ifaddrs* ifa) {
     struct sockaddr_in* sa;
     char* addr_str;
 
@@ -72,6 +74,16 @@
     this->ril_broadcast = strtok(addr_str, "\n");
     auto broadcast_s_addr = ntohl(sa->sin_addr.s_addr);
 
+    // Detect misconfigured network interfaces. All network interfaces must
+    // have a valid broadcast address set; if there is none set, glibc may
+    // return the interface address in the broadcast field. This causes
+    // no packets to be routed correctly from the guest.
+    if (this->ril_gateway == this->ril_broadcast) {
+      LOG(ERROR) << "Gateway and Broadcast addresses are the same on "
+                 << ifa->ifa_name << ", which is invalid.";
+      return false;
+    }
+
     // Netmask
     sa = reinterpret_cast<sockaddr_in*>(ifa->ifa_netmask);
     this->ril_prefixlen = number_of_ones(sa->sin_addr.s_addr);
@@ -99,14 +111,14 @@
     return true;
   }
 
-  bool ParseIntefaceAttributes(const std::string& interface) {
+  bool ParseInterfaceAttributes(const std::string& interface) {
     struct ifaddrs *ifa_list{}, *ifa{};
     bool ret = false;
     getifaddrs(&ifa_list);
     for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
       if (strcmp(ifa->ifa_name, interface.c_str()) == 0 &&
           ifa->ifa_addr->sa_family == AF_INET) {
-        ret = ParseIntefaceAttributes(ifa);
+        ret = ParseInterfaceAttributes(ifa);
         break;
       }
     }
@@ -140,9 +152,15 @@
     const vsoc::CuttlefishConfig& config) {
   auto instance = config.ForDefaultInstance();
   NetConfig netconfig;
+  // Check the mobile bridge first; this was the traditional way we configured
+  // the mobile interface. If that fails, it probably means we are using a
+  // newer version of cuttlefish-common, and we can use the tap device
+  // directly instead.
   if (!netconfig.ObtainConfig(instance.mobile_bridge_name())) {
-    LOG(ERROR) << "Unable to obtain the network configuration";
-    return false;
+    if (!netconfig.ObtainConfig(instance.mobile_tap_name())) {
+      LOG(ERROR) << "Unable to obtain the network configuration";
+      return false;
+    }
   }
 
   auto res = snprintf(data_.ril.ipaddr, sizeof(data_.ril.ipaddr), "%s",
diff --git a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceService.java b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceService.java
index 34f3b1a..8e7bcc5 100644
--- a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceService.java
+++ b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceService.java
@@ -45,12 +45,9 @@
     private static final int NOTIFICATION_ID = 1;
 
     private final JobExecutor mExecutor = new JobExecutor();
-    private final LocationServicesManager mLocationServices = new LocationServicesManager(this);
-    private final PackageVerificationConsentEnforcer mConsentEnforcer = new PackageVerificationConsentEnforcer(this);
     private final BootReporter mBootReporter = new BootReporter();
     private final GceBroadcastReceiver mBroadcastReceiver = new GceBroadcastReceiver();
     private final BluetoothChecker mBluetoothChecker = new BluetoothChecker();
-    private final TombstoneChecker mTombstoneChecker = new TombstoneChecker();
 
     private ConnectivityChecker mConnChecker;
     private GceWifiManager mWifiManager = null;
@@ -69,20 +66,11 @@
             mConnChecker = new ConnectivityChecker(this, mBootReporter);
             mWifiManager = new GceWifiManager(this, mBootReporter, mExecutor);
 
-            mExecutor.schedule(mLocationServices);
-            mExecutor.schedule(mConsentEnforcer);
             mExecutor.schedule(mWifiManager);
             mExecutor.schedule(mBluetoothChecker);
             mExecutor.schedule(mConnChecker);
-            // TODO(ender): TombstoneChecker is disabled, because we no longer have the code that
-            // produces /ts_snap.txt file. We need to rethink how TombstoneChecker should work.
-            // mExecutor.schedule(mTombstoneChecker);
 
-            mExecutor.schedule(mBootReporter,
-                    mLocationServices.getLocationServicesReady(),
-                    mBluetoothChecker.getEnabled()
-                    // mTombstoneChecker.getTombstoneResult()
-                    );
+            mExecutor.schedule(mBootReporter, mBluetoothChecker.getEnabled());
 
             NotificationManager notificationManager =
                     (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
@@ -171,13 +159,9 @@
         }
         pw.println("");
         pw.println("Current system service state:");
-        pw.println("  Location service ready: "
-            + mLocationServices.getLocationServicesReady().isDone());
         pw.println("  Network connected: " + mConnChecker.getConnected().isDone());
         pw.println("  WiFi configured: " + mWifiManager.getWifiReady().isDone());
         pw.println("  Bluetooth enabled: " + mBluetoothChecker.getEnabled().isDone());
-        pw.println("  Tombstone dropped (on boot): "
-            + !mTombstoneChecker.getTombstoneResult().isDone());
         pw.println("");
     }
 }
diff --git a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceWifiManager.java b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceWifiManager.java
index 2747110..1b07c04 100644
--- a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceWifiManager.java
+++ b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/GceWifiManager.java
@@ -77,12 +77,6 @@
         return mMonitorWifiJob.getWifiReady();
     }
 
-
-    /* Modifies Wifi state:
-     * - if wifi disable requested (state == false), simply turns off wifi.
-     * - if wifi enable requested (state == true), turns on wifi and arms the
-     *   connection timeout (see startWifiReconnectionTimeout).
-     */
     private class MonitorWifiJob extends JobBase {
         private final GceFuture<Boolean> mWifiReady =
                 new GceFuture<Boolean>("WIFI Ready");
diff --git a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/LocationServicesManager.java b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/LocationServicesManager.java
deleted file mode 100644
index f9ad388..0000000
--- a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/LocationServicesManager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 com.android.google.gce.gceservice;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
-import android.util.Log;
-import com.android.google.gce.gceservice.GceFuture;
-import com.android.google.gce.gceservice.JobBase;
-
-/**
- * Configure Location Services on Android Jellybean.
- * No action on more recent versions of Android.
- */
-class LocationServicesManager extends JobBase {
-    private static final String LOG_TAG = "GceLocationServicesManager";
-    private static final String ACTION_LOCATION_SERVICES_CONSENT_INTENT =
-            "com.google.android.gsf.action.SET_USE_LOCATION_FOR_SERVICES";
-    private static final String EXTRA_LOCATION_SERVICES_CONSENT_DISABLE =
-            "disable";
-    private final Context mContext;
-    private final GceFuture<Boolean> mResult = new GceFuture<Boolean>("Location Services");
-
-
-    LocationServicesManager(Context context) {
-        super(LOG_TAG);
-        mContext = context;
-    }
-
-
-    public int execute() {
-        /* Check if we're running Jellybean.
-         * Sadly, we can't use version name Build.VERSION_CODES.JELLY_BEAN_MR2
-         * because MR1 and MR0 don't know this number.
-         */
-        if (Build.VERSION.SDK_INT <= 18) {
-            Intent intent = new Intent();
-            intent.setAction(ACTION_LOCATION_SERVICES_CONSENT_INTENT);
-            intent.setFlags(intent.getFlags() |
-                    Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
-            intent.putExtra(EXTRA_LOCATION_SERVICES_CONSENT_DISABLE, false);
-            mContext.startActivity(intent);
-        }
-
-        mResult.set(true);
-        return 0;
-    }
-
-
-    public void onDependencyFailed(Exception e) {
-        Log.e(LOG_TAG, "Could not configure LocationServices.", e);
-        mResult.set(e);
-    }
-
-
-    public GceFuture<Boolean> getLocationServicesReady() {
-        return mResult;
-    }
-}
diff --git a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/PackageVerificationConsentEnforcer.java b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/PackageVerificationConsentEnforcer.java
deleted file mode 100644
index e45d656..0000000
--- a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/PackageVerificationConsentEnforcer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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 com.android.google.gce.gceservice;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.provider.Settings;
-import android.provider.Settings.SettingNotFoundException;
-import android.util.Log;
-
-/**
- * Forces pacakge verification to be off on N and N-MR1 by adjusting package_verifier_user_consent.
- *
- * This is needed because CVDs don't have a touch screen, and the consent
- * dialog will block apk installs.
- *
- * Possible values for consent seem to be:
- *   -1 The user refused
- *    0 Ask the user
- *    1 The user accepted
- *
- * This code polls because Android may overwrite a non-zero value with a 0
- * at some point after boot completes. However, this happens only on some
- * boots, so it can't be a blocker for boot complete.
- */
-class PackageVerificationConsentEnforcer extends JobBase {
-    private static final String LOG_TAG = "GcePVCR";
-    private static final String PACKAGE_VERIFIER_USER_CONSENT = "package_verifier_user_consent";
-    private final Context mContext;
-
-    // Chosen to avoid the possible values (see top comment).
-    private int mLastObservedValue = -2;
-
-
-    public PackageVerificationConsentEnforcer(Context context) {
-        super(LOG_TAG);
-        mContext = context;
-    }
-
-
-    public int execute() {
-        if (android.os.Build.VERSION.SDK_INT < 24) {
-            // Skip older android versions.
-            return 0;
-        }
-
-        try {
-            ContentResolver contentResolver = mContext.getContentResolver();
-            int value = Settings.Secure.getInt(contentResolver, PACKAGE_VERIFIER_USER_CONSENT);
-            if (value != mLastObservedValue) {
-                mLastObservedValue = value;
-            }
-
-            if (value == 0) {
-                Settings.Secure.putInt(mContext.getContentResolver(), PACKAGE_VERIFIER_USER_CONSENT, -1);
-            }
-        } catch (SettingNotFoundException e) {
-        }
-
-        return 1;
-    }
-
-
-    public void onDependencyFailed(Exception e) {
-        Log.e(LOG_TAG, "Could not start Consent Enforcer.", e);
-    }
-}
-
-
diff --git a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/TombstoneChecker.java b/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/TombstoneChecker.java
deleted file mode 100644
index dec0837..0000000
--- a/guest/monitoring/cuttlefish_service/java/com/android/google/gce/gceservice/TombstoneChecker.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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 com.android.google.gce.gceservice;
-
-import android.util.Log;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Scanner;
-
-/** A job that checks for any new tombstones before reporting VIRTUAL_DEVICE_BOOT_COMPLETED.
- *
- */
-public class TombstoneChecker extends JobBase {
-    private static final String LOG_TAG = "GceTombstoneChecker";
-    private static final String sSnapshotDir = "/data/tombstones";
-    private static final String sSnapshotFile = "/ts_snap.txt";
-    private static final String sTsExceptionMessage = "GceTombstoneChecker internal error. ";
-    private static final String sTsFilePrefix = "tombstone";
-    private final GceFuture<Boolean> mPassed = new GceFuture<Boolean>("GceTombstoneChecker");
-    private ArrayList<Record> mPreBootRecords = new ArrayList<Record>();
-    private ArrayList<Record> mPostBootRecords = new ArrayList<Record>();
-
-    public TombstoneChecker() {
-        super(LOG_TAG);
-    }
-
-
-    @Override
-    public int execute() {
-        if (mPassed.isDone()) {
-            return 0;
-        }
-
-        try {
-            readPreBootSnapshot();
-            capturePostBootSnapshot();
-            if (seenNewTombstones()) {
-                Log.e(LOG_TAG, "Tombstones created during boot. ");
-                for (int i = 0; i < mPostBootRecords.size(); i++) {
-                    Log.i(LOG_TAG, mPostBootRecords.get(i).getFileName());
-                }
-                mPassed.set(new Exception("Tombstones created. "));
-            } else {
-                mPassed.set(true);
-            }
-        } catch(Exception e) {
-            Log.e(LOG_TAG, sTsExceptionMessage + e);
-            mPassed.set(new Exception(sTsExceptionMessage, e));
-        }
-
-        return 0;
-    }
-
-    @Override
-    public void onDependencyFailed(Exception e) {
-        mPassed.set(e);
-    }
-
-    public GceFuture<Boolean> getTombstoneResult() {
-        return mPassed;
-    }
-
-    private void capturePostBootSnapshot() throws Exception {
-        File dir = new File(sSnapshotDir);
-        File[] files = dir.listFiles();
-
-        // In K & L, /data/tombstones directory is not created during boot. So
-        // dir.listFiles() can return null.
-        if (files == null) {
-            return;
-        }
-
-        for (int i = 0; i < files.length; i++) {
-            if (files[i].isFile() && files[i].getName().startsWith(sTsFilePrefix)) {
-                long ctime = files[i].lastModified() / 1000;
-                mPostBootRecords.add(new Record(files[i].getName(), ctime));
-            }
-        }
-        Collections.sort(mPostBootRecords);
-
-        return;
-    }
-
-    private void readPreBootSnapshot() throws Exception {
-        File file = new File(sSnapshotFile);
-        if (!file.isFile()) {
-            throw new FileNotFoundException(sSnapshotFile);
-        }
-
-        Scanner scanner = new Scanner(file);
-        while (scanner.hasNext()) {
-            String[] fields = scanner.nextLine().split(" ");
-            mPreBootRecords.add(new Record(fields[0], Long.parseLong(fields[1])));
-        }
-        Collections.sort(mPreBootRecords);
-
-        return;
-    }
-
-    private boolean seenNewTombstones() {
-        return !isEqual(mPreBootRecords, mPostBootRecords);
-    }
-
-    private boolean isEqual(ArrayList<Record> preBoot, ArrayList<Record> postBoot) {
-        postBoot.removeAll(preBoot);
-        if (postBoot.size() != 0) {
-            return false;
-        }
-
-        return true;
-    }
-
-    private class Record implements Comparable<Record> {
-        private String mFilename;
-        private long mCtime;
-
-        public Record(String filename, long ctime) {
-            this.mFilename = filename;
-            this.mCtime = ctime;
-        }
-
-        public String getFileName() {
-            return mFilename;
-        }
-
-        public int compareTo(Record r) {
-            if (this == r) {
-                return 0;
-            }
-
-            return (mFilename.compareTo(r.mFilename));
-        }
-
-        public boolean equals(Object o) {
-            if (o == null) {
-                return false;
-            }
-
-            if (this == o) {
-                return true;
-            }
-
-            Record r = (Record) o;
-            return (mFilename.equals(r.mFilename) && (mCtime == r.mCtime));
-        }
-
-        public String toString() {
-            StringBuilder sb = new StringBuilder();
-            sb.append(mFilename).append(" ").append(String.valueOf(mCtime));
-            return sb.toString();
-        }
-    }
-}
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 5064c81..827ac4f 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -860,7 +860,7 @@
 
   for (const auto& instance : config->Instances()) {
     if (!cvd::FileExists(instance.access_kregistry_path())) {
-      CreateBlankImage(instance.access_kregistry_path(), 1, "none", "64K");
+      CreateBlankImage(instance.access_kregistry_path(), 2, "none", "1M");
     }
   }
 
@@ -886,7 +886,7 @@
                      << "newer than its underlying composite disk. Wiping the overlay.";
       }
       CreateQcowOverlay(config->crosvm_binary(), config->composite_disk_path(), overlay_path);
-      CreateBlankImage(instance.access_kregistry_path(), 1, "none", "64K");
+      CreateBlankImage(instance.access_kregistry_path(), 2, "none", "1M");
     }
   }
 
diff --git a/shared/auto/device.mk b/shared/auto/device.mk
index b19f559..fbed739 100644
--- a/shared/auto/device.mk
+++ b/shared/auto/device.mk
@@ -29,36 +29,25 @@
     packages/services/Car/car_product/init/init.bootstat.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw//init.bootstat.rc \
     packages/services/Car/car_product/init/init.car.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw//init.car.rc
 
-# Auto core hardware permissions
 PRODUCT_COPY_FILES += \
+    frameworks/native/data/etc/android.hardware.broadcastradio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.broadcastradio.xml \
+    frameworks/native/data/etc/android.hardware.screen.landscape.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.screen.landscape.xml \
+    frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
+    frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
+    frameworks/native/data/etc/android.software.activities_on_secondary_displays.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.activities_on_secondary_displays.xml \
     frameworks/native/data/etc/car_core_hardware.xml:system/etc/permissions/car_core_hardware.xml \
-    frameworks/native/data/etc/android.hardware.type.automotive.xml:system/etc/permissions/android.hardware.type.automotive.xml \
-
-# Enable landscape
-PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.hardware.screen.landscape.xml:system/etc/permissions/android.hardware.screen.landscape.xml
-
-# Used to embed a map in an activity view
-PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.software.activities_on_secondary_displays.xml:system/etc/permissions/android.software.activities_on_secondary_displays.xml
-
-# Location permissions
-PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.hardware.location.gps.xml:system/etc/permissions/android.hardware.location.gps.xml
-
-# Broadcast Radio permissions
-PRODUCT_COPY_FILES += \
-    frameworks/native/data/etc/android.hardware.broadcastradio.xml:system/etc/permissions/android.hardware.broadcastradio.xml
 
 PRODUCT_PROPERTY_OVERRIDES += \
     keyguard.no_require_sim=true \
     ro.cdma.home.operator.alpha=Android \
     ro.cdma.home.operator.numeric=302780 \
+    ro.com.android.dataroaming=true \
     vendor.rild.libpath=libcuttlefish-ril.so \
 
 # vehicle HAL
 ifeq ($(LOCAL_VHAL_PRODUCT_PACKAGE),)
     LOCAL_VHAL_PRODUCT_PACKAGE := android.hardware.automotive.vehicle@2.0-service
+    BOARD_SEPOLICY_DIRS += device/google/cuttlefish/shared/auto/sepolicy
 endif
 PRODUCT_PACKAGES += $(LOCAL_VHAL_PRODUCT_PACKAGE)
 
@@ -71,9 +60,6 @@
 endif
 PRODUCT_PACKAGES += $(LOCAL_AUDIOCONTROL_HAL_PRODUCT_PACKAGE)
 
-# DRM HAL
-PRODUCT_PACKAGES += android.hardware.drm@1.3-service.clearkey
-
 # CAN bus HAL
 PRODUCT_PACKAGES += android.hardware.automotive.can@1.0-service
 PRODUCT_PACKAGES_DEBUG += canhalctrl \
@@ -84,10 +70,6 @@
     libcuttlefish-ril \
     libcuttlefish-rild
 
-# DRM Properities
-PRODUCT_PROPERTY_OVERRIDES += \
-    drm.service.enabled=true
-
 BOARD_IS_AUTOMOTIVE := true
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
diff --git a/shared/auto/sepolicy/hal_vehicle_default.te b/shared/auto/sepolicy/hal_vehicle_default.te
new file mode 100644
index 0000000..c0a9698
--- /dev/null
+++ b/shared/auto/sepolicy/hal_vehicle_default.te
@@ -0,0 +1,3 @@
+# Configuration for register VHAL to car watchdog
+carwatchdog_client_domain(hal_vehicle_default)
+binder_use(hal_vehicle_default)
diff --git a/shared/auto/sepolicy/system_server.te b/shared/auto/sepolicy/system_server.te
new file mode 100644
index 0000000..a9ce1b1
--- /dev/null
+++ b/shared/auto/sepolicy/system_server.te
@@ -0,0 +1,2 @@
+# Allow system_server to kill vehicle HAL
+allow system_server hal_vehicle_server:process sigkill;
diff --git a/shared/device.mk b/shared/device.mk
index 87b32c5..ce41fe0 100644
--- a/shared/device.mk
+++ b/shared/device.mk
@@ -69,7 +69,6 @@
     ro.opengles.version=196608 \
     wifi.interface=wlan0 \
     persist.sys.zram_enabled=1 \
-    ro.apk_verity.mode=2 \
     ro.rebootescrow.device=/dev/block/pmem0 \
     ro.incremental.enable=1 \
 
@@ -86,6 +85,9 @@
 # Copy preopted files from system_b on first boot
 PRODUCT_PROPERTY_OVERRIDES += ro.cp_system_other_odex=1
 
+# DRM service opt-in
+PRODUCT_PROPERTY_OVERRIDES += drm.service.enabled=true
+
 PRODUCT_SOONG_NAMESPACES += hardware/google/camera
 PRODUCT_SOONG_NAMESPACES += hardware/google/camera/devices/EmulatedCamera
 
@@ -179,6 +181,7 @@
     device/google/cuttlefish/shared/config/media_codecs_google_video.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_video.xml \
     device/google/cuttlefish/shared/config/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
     device/google/cuttlefish/shared/config/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
+    device/google/cuttlefish/shared/permissions/cuttlefish_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/cuttlefish_excluded_hardware.xml \
     device/google/cuttlefish/shared/permissions/privapp-permissions-cuttlefish.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/privapp-permissions-cuttlefish.xml \
     frameworks/av/media/libeffects/data/audio_effects.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_effects.xml \
     frameworks/av/media/libstagefright/data/media_codecs_google_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_google_audio.xml \
@@ -191,24 +194,25 @@
     frameworks/av/services/audiopolicy/config/surround_sound_configuration_5_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/surround_sound_configuration_5_0.xml \
     frameworks/native/data/etc/android.hardware.audio.low_latency.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.audio.low_latency.xml \
     frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml \
-    frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
-    frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.xml \
-    frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
+    frameworks/native/data/etc/android.hardware.camera.concurrent.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.concurrent.xml \
+    frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \
     frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \
+    frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml \
     frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml \
-    frameworks/native/data/etc/android.hardware.ethernet.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.ethernet.xml \
+    frameworks/native/data/etc/android.hardware.faketouch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.faketouch.xml \
     frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \
     frameworks/native/data/etc/android.hardware.reboot_escrow.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.reboot_escrow.xml \
-    frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
+    frameworks/native/data/etc/android.hardware.sensor.ambient_temperature.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.ambient_temperature.xml \
     frameworks/native/data/etc/android.hardware.sensor.barometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.barometer.xml \
-    frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
     frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
     frameworks/native/data/etc/android.hardware.sensor.light.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.light.xml \
     frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml \
-    frameworks/native/data/etc/android.hardware.touchscreen.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.xml \
+    frameworks/native/data/etc/android.hardware.sensor.relative_humidity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.relative_humidity.xml \
     frameworks/native/data/etc/android.hardware.usb.accessory.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.usb.accessory.xml \
     frameworks/native/data/etc/android.hardware.wifi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.wifi.xml \
-    frameworks/native/data/etc/android.software.app_widgets.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.app_widgets.xml \
+    frameworks/native/data/etc/android.software.ipsec_tunnels.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.ipsec_tunnels.xml \
+    frameworks/native/data/etc/android.software.sip.voip.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.sip.voip.xml \
+    frameworks/native/data/etc/android.software.verified_boot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.verified_boot.xml \
     system/bt/vendor_libs/test_vendor_lib/data/controller_properties.json:vendor/etc/bluetooth/controller_properties.json \
     device/google/cuttlefish/shared/config/task_profiles.json:$(TARGET_COPY_OUT_VENDOR)/etc/task_profiles.json \
 
diff --git a/shared/permissions/cuttlefish_excluded_hardware.xml b/shared/permissions/cuttlefish_excluded_hardware.xml
new file mode 100644
index 0000000..3660289
--- /dev/null
+++ b/shared/permissions/cuttlefish_excluded_hardware.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 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.
+-->
+<permissions>
+    <unavailable-feature name="android.hardware.microphone" />
+    <unavailable-feature name="android.software.print" />
+    <unavailable-feature name="android.software.voice_recognizers" />
+</permissions>
diff --git a/shared/tv/device.mk b/shared/tv/device.mk
index 7e64f45..7b3dbef 100644
--- a/shared/tv/device.mk
+++ b/shared/tv/device.mk
@@ -20,6 +20,14 @@
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core_minimal.mk)
 $(call inherit-product, device/google/cuttlefish/shared/device.mk)
 
+PRODUCT_COPY_FILES += \
+    device/google/atv/permissions/tv_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/tv_core_hardware.xml \
+    frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \
+    frameworks/native/data/etc/android.hardware.hdmi.cec.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.hdmi.cec.xml \
+    frameworks/native/data/etc/android.hardware.sensor.accelerometer.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.accelerometer.xml \
+    frameworks/native/data/etc/android.hardware.sensor.compass.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.compass.xml \
+    frameworks/native/data/etc/android.hardware.touchscreen.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.touchscreen.xml \
+
 # HDMI CEC HAL
 PRODUCT_PACKAGES += android.hardware.tv.cec@1.0-service.mock
 
@@ -27,5 +35,4 @@
 PRODUCT_PACKAGES += android.hardware.tv.tuner@1.0-service
 
 # Enabling managed profiles
-PRODUCT_COPY_FILES += frameworks/native/data/etc/android.software.managed_users.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.managed_users.xml
 DEVICE_PACKAGE_OVERLAYS += device/google/cuttlefish/shared/tv/overlay