aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Pedowitz <ijpedowitz@google.com>2017-08-11 20:20:07 -0700
committerIan Pedowitz <ijpedowitz@google.com>2017-08-11 20:21:25 -0700
commit2ca2bafa5c2efb8d9d4181c05fc736a34fc05327 (patch)
tree7a5bdea7be78de320cec03dd96414cad60b2fa3a
parentd8aeaec2bb351e9ac95103a4309250137a2557b5 (diff)
downloadlibcore-oreo-dr1-dev.tar.gz
Revert "Test app for time zone updates"oreo-dr1-dev
This reverts commit c04e68e270ceb605413f87f236a63f41ab71b930. Fixes: 64606807 Test: Grab the cts binaries(android-cts.zip) from OC Release Test: Extract and from android-cts/tools directory, launch ./cts-tradefed Test: On the DUT with CL cherrypicked, run the below(will run this test on both abi's): Test: run cts -m CtsPermission2TestCases -t android.permission2.cts.PermissionPolicyTest#testPlatformPermissionPolicyUnaltered --skip-connectivity-check --skip-preconditions --serial <device serial> Test: android.permission2.cts.PermissionPolicyTest#testPlatformPermissionPolicyUnaltered doesn't fail for android namespace:android.permission.TRIGGER_TIME_ZONE_RULES_CHECK Merged-In: I556b69f98f2386fd99098086140c3d4f07574fb2 Change-Id: I87f09603ab5d163eded2ea341ed9b8fe75867afb
-rw-r--r--tzdata/update_test_app2/Android.mk25
-rw-r--r--tzdata/update_test_app2/AndroidManifest.xml23
-rw-r--r--tzdata/update_test_app2/res/drawable/ic_launcher.pngbin9397 -> 0 bytes
-rw-r--r--tzdata/update_test_app2/res/layout/activity_main.xml98
-rw-r--r--tzdata/update_test_app2/res/values/strings.xml11
-rw-r--r--tzdata/update_test_app2/src/libcore/tzdata/update_test_app2/installupdatetestapp/MainActivity.java211
6 files changed, 0 insertions, 368 deletions
diff --git a/tzdata/update_test_app2/Android.mk b/tzdata/update_test_app2/Android.mk
deleted file mode 100644
index c1ae6366359..00000000000
--- a/tzdata/update_test_app2/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright (C) 2015 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 := optional
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := UpdateTestApp2
-LOCAL_CERTIFICATE := platform
-include $(BUILD_PACKAGE)
diff --git a/tzdata/update_test_app2/AndroidManifest.xml b/tzdata/update_test_app2/AndroidManifest.xml
deleted file mode 100644
index fd42bb59997..00000000000
--- a/tzdata/update_test_app2/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="libcore.tzdata.update_test_app2.installupdatetestapp" >
-
- <uses-permission android:name="android.permission.UPDATE_TIME_ZONE_RULES" />
-
- <application
- android:allowBackup="false"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@android:style/Theme.Holo.Light">
- <activity
- android:name=".MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
-
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
diff --git a/tzdata/update_test_app2/res/drawable/ic_launcher.png b/tzdata/update_test_app2/res/drawable/ic_launcher.png
deleted file mode 100644
index 96a442e5b8e..00000000000
--- a/tzdata/update_test_app2/res/drawable/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/tzdata/update_test_app2/res/layout/activity_main.xml b/tzdata/update_test_app2/res/layout/activity_main.xml
deleted file mode 100644
index 16e4b118f27..00000000000
--- a/tzdata/update_test_app2/res/layout/activity_main.xml
+++ /dev/null
@@ -1,98 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- tools:context=".MainActivity">
-
- <LinearLayout
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/content_path"
- android:id="@+id/content_path_label" />
-
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/default_content_path"
- android:id="@+id/content_path" />
-
- </LinearLayout>
-
- <Button
- android:id="@+id/trigger_install_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/trigger_install" />
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="2dip"
- android:background="#FF00FF00" />
-
- <Button
- android:id="@+id/trigger_uninstall_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/trigger_uninstall" />
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="2dip"
- android:background="#FF00FF00" />
-
- <CheckBox android:id="@+id/success_checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/success" />
-
- <Button
- android:id="@+id/trigger_nothing"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/trigger_nothing" />
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="2dip"
- android:background="#FF00FF00" />
-
- <Button
- android:id="@+id/get_rules_state_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/get_rules_state" />
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="2dip"
- android:background="#FF00FF00" />
-
- <ScrollView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:scrollbars="vertical"
- android:fillViewport="true">
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:id="@+id/log"
- android:singleLine="false" />
-
- </ScrollView>
-
-</LinearLayout>
diff --git a/tzdata/update_test_app2/res/values/strings.xml b/tzdata/update_test_app2/res/values/strings.xml
deleted file mode 100644
index 9bb5f57c087..00000000000
--- a/tzdata/update_test_app2/res/values/strings.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_name">InstallUpdateTestApp2</string>
- <string name="content_path">Content Path</string>
- <string name="default_content_path">/data/local/tmp/out.zip</string>
- <string name="trigger_install">Request Install</string>
- <string name="trigger_uninstall">Request Uninstall</string>
- <string name="trigger_nothing">Request Nothing</string>
- <string name="success">Success</string>
- <string name="get_rules_state">Get rules state</string>
-</resources>
diff --git a/tzdata/update_test_app2/src/libcore/tzdata/update_test_app2/installupdatetestapp/MainActivity.java b/tzdata/update_test_app2/src/libcore/tzdata/update_test_app2/installupdatetestapp/MainActivity.java
deleted file mode 100644
index caa52c43781..00000000000
--- a/tzdata/update_test_app2/src/libcore/tzdata/update_test_app2/installupdatetestapp/MainActivity.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2015 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 libcore.tzdata.update_test_app2.installupdatetestapp;
-
-import android.app.Activity;
-import android.app.timezone.Callback;
-import android.app.timezone.RulesManager;
-import android.app.timezone.RulesState;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.ParcelFileDescriptor;
-import android.view.View;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.TextView;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Date;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class MainActivity extends Activity implements View.OnClickListener {
-
- private EditText contentPathEditText;
- private TextView logView;
-
- private RulesManager rulesManager;
- private Callback callback;
- private ExecutorService executor;
- private CheckBox successCheckbox;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- Button triggerInstallButton = (Button) findViewById(R.id.trigger_install_button);
- triggerInstallButton.setOnClickListener(this);
- Button triggerUninstallButton = (Button) findViewById(R.id.trigger_uninstall_button);
- triggerUninstallButton.setOnClickListener(this);
- Button triggerCheckCompleteButton = (Button) findViewById(R.id.trigger_nothing);
- triggerCheckCompleteButton.setOnClickListener(this);
- successCheckbox = (CheckBox) findViewById(R.id.success_checkbox);
-
- Button getRulesStateButton = (Button) findViewById(R.id.get_rules_state_button);
- getRulesStateButton.setOnClickListener(this);
-
- contentPathEditText = (EditText) findViewById(R.id.content_path);
- logView = (TextView) findViewById(R.id.log);
- executor = Executors.newFixedThreadPool(1);
- rulesManager = (RulesManager) getSystemService("timezone");
- callback = new Callback() {
- @Override
- public void onFinished(int status) {
- logString("Operation finished. Status=" + status);
- }
- };
- }
-
- private abstract class MyAsyncTask extends AsyncTask<Void, String, Void> {
- @Override
- protected void onProgressUpdate(String... values) {
- for (String message : values) {
- addToLog(message, null);
- }
- }
- }
-
- @Override
- public void onClick(View v) {
- MyAsyncTask task;
- if (v.getId() == R.id.trigger_install_button) {
- final String contentPath = contentPathEditText.getText().toString();
- final File contentFile = new File(contentPath);
-
- // Convert the contentFile to a ParcelFileDescriptor.
- final ParcelFileDescriptor distroFileDescriptor =
- createParcelFileDescriptor(contentFile);
- if (distroFileDescriptor == null) {
- return;
- }
-
- Callback callback = new Callback() {
- @Override
- public void onFinished(int status) {
- logString("onFinished: Finished install: " + status);
-
- // TODO(nfuller): Can this be closed sooner?
- try {
- distroFileDescriptor.close();
- } catch (IOException e) {
- logString("Unable to close ParcelFileDescriptor for " + contentFile + ": "
- + exceptionToString(e));
- }
- }
- };
-
- task = new MyAsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- if (!contentFile.exists()) {
- publishProgress("Error: " + contentFile + " does not exist.");
- return null;
- }
- try {
- int requestStatus = rulesManager.requestInstall(
- distroFileDescriptor, null /* checkToken */, callback);
- publishProgress("Request sent:" + requestStatus);
- } catch (Exception e) {
- publishProgress("Error", exceptionToString(e));
- }
- return null;
- }
- };
- } else if (v.getId() == R.id.trigger_uninstall_button) {
- task = new MyAsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- try {
- int requestStatus = rulesManager.requestUninstall(
- null /* checkToken */, callback);
- publishProgress("Request sent:" + requestStatus);
- } catch (Exception e) {
- publishProgress("Error", exceptionToString(e));
- }
- return null;
- }
- };
- } else if (v.getId() == R.id.trigger_nothing) {
- final boolean success = successCheckbox.isChecked();
- task = new MyAsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- try {
- rulesManager.requestNothing(null /* checkToken */, success);
- publishProgress("Request sent");
- } catch (Exception e) {
- publishProgress("Error", exceptionToString(e));
- }
- return null;
- }
- };
- } else if (v.getId() == R.id.get_rules_state_button) {
- task = new MyAsyncTask() {
- @Override
- protected Void doInBackground(Void... params) {
- try {
- RulesState rulesState = rulesManager.getRulesState();
- publishProgress("Rules state: " + rulesState);
- } catch (Exception e) {
- publishProgress("Error", exceptionToString(e));
- }
- return null;
- }
- };
- } else {
- addToLog("Unknown button", null);
- return;
- }
- task.executeOnExecutor(executor);
- }
-
- private ParcelFileDescriptor createParcelFileDescriptor(File contentFile) {
- try {
- return ParcelFileDescriptor.open(contentFile, ParcelFileDescriptor.MODE_READ_ONLY);
- } catch (FileNotFoundException e) {
- logString("Unable to create ParcelFileDescriptor from " + contentFile + ": "
- + exceptionToString(e));
- return null;
- }
- }
-
- private void addToLog(String message, Exception e) {
- logString(message);
- if (e != null) {
- String text = exceptionToString(e);
- logString(text);
- }
- }
-
- private void logString(String value) {
- logView.append(new Date() + " " + value + "\n");
- int scrollAmount =
- logView.getLayout().getLineTop(logView.getLineCount()) - logView.getHeight();
- logView.scrollTo(0, scrollAmount);
- }
-
- private static String exceptionToString(Exception e) {
- StringWriter writer = new StringWriter();
- e.printStackTrace(new PrintWriter(writer));
- return writer.getBuffer().toString();
- }
-}