[RESTRICT AUTOMERGE]: STS bp to mk for CVE-2021-0318

Bug: 173531328
Test: sts-tradefed run sts-engbuild-no-spl-lock -m CtsSecurityBulletinHostTestCases -t android.security.cts.Poc21_01#testPocCVE_2021_0318
Change-Id: I0bcb34785607865f920756ccae3fff2824bfac60
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.bp
deleted file mode 100644
index 2b63d91..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.
-
-cc_test {
-    name: "CVE-2021-0318",
-    defaults: ["cts_hostsidetests_securitybulletin_defaults"],
-    srcs: ["poc.cpp"],
-    shared_libs: [
-       "libsensor",
-       "libsensorservice",
-       "libbinder",
-       "libutils",
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wextra",
-    ],
-}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.mk
new file mode 100644
index 0000000..72aa29d
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/Android.mk
@@ -0,0 +1,35 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CVE-2021-0318
+LOCAL_SRC_FILES := poc.cpp
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+LOCAL_SHARED_LIBRARIES:= \
+    libsensor \
+    libsensorservice \
+    libbinder \
+    libutils \
+
+# Tag this module as a cts/sts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts sts vts
+LOCAL_CTS_TEST_PACKAGE := android.security.cts
+
+LOCAL_ARM_MODE := arm
+LOCAL_CFLAGS := -Wall -Werror -Wextra
+include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/poc.cpp
index cd67392..f8d1f68 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0318/poc.cpp
@@ -30,7 +30,7 @@
     String16 name(String16("sensorservice"));
     sp<IBinder> service = sm->getService(name);
 
-    if (service) {
+    if (service != nullptr) {
         Parcel data, reply;
         data.writeInterfaceToken(service->getInterfaceDescriptor());
         data.writeString8(String8("com.android.systemui.doze.DozeScreenBrightness"));
@@ -41,7 +41,7 @@
 
         sp<IBinder> binder = reply.readStrongBinder();
 
-        if (binder) {
+        if (binder != nullptr) {
             {
                 Parcel data, reply;
                 data.writeInterfaceToken(binder->getInterfaceDescriptor());
@@ -91,7 +91,7 @@
     sp<IServiceManager> sm = defaultServiceManager();
     String16 name(String16("sensorservice"));
     sp<IBinder> service = sm->getService(name);
-    if (service) {
+    if (service != nullptr) {
         Parcel data, reply;
         data.writeInterfaceToken(String16("android.gui.SensorServer"));
         data.writeString16(String16("opPackageName"));