Merge "vndk-def: Add regex matching to tag file reader"
diff --git a/build/sdk.atree b/build/sdk.atree
index 4ec733d..73551b0 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -46,6 +46,7 @@
bin/fastboot strip platform-tools/fastboot
bin/mke2fs strip platform-tools/mke2fs
bin/e2fsdroid strip platform-tools/e2fsdroid
+bin/make_f2fs strip platform-tools/make_f2fs
bin/sqlite3 strip platform-tools/sqlite3
bin/dmtracedump strip platform-tools/dmtracedump
bin/etc1tool strip platform-tools/etc1tool
diff --git a/python-packages/gdbrunner/__init__.py b/python-packages/gdbrunner/__init__.py
index 3063c75..17b9833 100644
--- a/python-packages/gdbrunner/__init__.py
+++ b/python-packages/gdbrunner/__init__.py
@@ -86,6 +86,9 @@
# busybox truncates the output, and very long package names like
# com.exampleisverylongtoolongbyfar.plasma exceed the limit.
#
+ # API 26 use toybox instead of toolbox for ps and needs -A to list
+ # all processes.
+ #
# Perform the check for this on the device to avoid an adb roundtrip
# Some devices might not have readlink or which, so we need to handle
# this as well.
@@ -95,10 +98,12 @@
ps_script = """
if $(ls /system/bin/readlink >/dev/null 2>&1); then
- if [ $(readlink /system/bin/ps) == "toolbox" ]; then
- ps;
- else
+ if [ $(readlink /system/bin/ps) == "busybox" ]; then
ps -w;
+ elif [ $(readlink /system/bin/ps) == "toybox" ]; then
+ ps -A;
+ else
+ ps;
fi
else
ps;
diff --git a/samples/apkcachetest/Android.mk b/samples/apkcachetest/Android.mk
new file mode 100644
index 0000000..d7c7a44
--- /dev/null
+++ b/samples/apkcachetest/Android.mk
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2016 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_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := ApkCacheTest
+
+LOCAL_CERTIFICATE := shared
+
+LOCAL_PROGUARD_ENABLED := disabled
+
+include $(BUILD_PACKAGE)
diff --git a/samples/apkcachetest/AndroidManifest.xml b/samples/apkcachetest/AndroidManifest.xml
new file mode 100644
index 0000000..de8ac01
--- /dev/null
+++ b/samples/apkcachetest/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ 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
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.apkcachetest" >
+
+ <application android:label="ApkCacheTest">
+ <activity android:name=".Main" android:label="ApkCacheTest">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/samples/apkcachetest/res/layout/hello_activity.xml b/samples/apkcachetest/res/layout/hello_activity.xml
new file mode 100644
index 0000000..ae33e78
--- /dev/null
+++ b/samples/apkcachetest/res/layout/hello_activity.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
\ No newline at end of file
diff --git a/samples/apkcachetest/src/com/android/apkcachetest/Main.java b/samples/apkcachetest/src/com/android/apkcachetest/Main.java
new file mode 100644
index 0000000..7fb4557
--- /dev/null
+++ b/samples/apkcachetest/src/com/android/apkcachetest/Main.java
@@ -0,0 +1,69 @@
+/*
+ * 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.apkcachetest;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.FileUtils;
+import android.widget.TextView;
+
+import java.io.File;
+import java.io.IOException;
+
+public class Main extends Activity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.hello_activity);
+ File preloadsFileCache = getPreloadsFileCache();
+ TextView txt = (TextView) findViewById(R.id.text);
+ if (!getApplicationInfo().isPrivilegedApp()) {
+ txt.append("WARNING: App must be installed in /system/priv-app directory to access "
+ + "preloads cache\n");
+ }
+ txt.append("PreloadsFileCache app directory: " + preloadsFileCache + '\n');
+ if (!preloadsFileCache.exists()) {
+ txt.append(" --- Directory does not exist ---\n");
+ } else {
+ File[] files = preloadsFileCache.listFiles();
+ if (files == null || files.length == 0) {
+ txt.append(" --- No files found ---\n");
+ } else {
+ for (File file : files) {
+ try {
+ txt.append(" " + file.getName() + ": [" + readTextFile(file) + "]\n");
+ } catch (IOException e) {
+ txt.append(" " + file.getName() + ": Error " + e + "\n");
+ e.printStackTrace();
+ }
+ }
+ txt.append(files.length + " files");
+ }
+
+ }
+ }
+
+ String readTextFile(File file) throws IOException {
+ String s = FileUtils.readTextFile(file, 100, "...");
+ if (s != null) {
+ s = s.replaceAll("[^\\x20-\\x7E]+", " ");
+ }
+ return s;
+ }
+}