delete droiddream cleanup tool.
Remove obsolete droiddreamclean and AndroidVendorSecurityTool.
Change-Id: Id5124d5d8f98f26fa9c19044d586c95053c28a65
diff --git a/AndroidVendorSecurityTool/Android.mk b/AndroidVendorSecurityTool/Android.mk
deleted file mode 100644
index 734b6af..0000000
--- a/AndroidVendorSecurityTool/Android.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (C) 2011 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_CERTIFICATE := platform
-LOCAL_MODULE_TAGS := eng
-LOCAL_PACKAGE_NAME := AVST
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_SRC_FILES += src/com/google/android/googleapps/IGoogleLoginService.aidl
-include $(BUILD_PACKAGE)
diff --git a/AndroidVendorSecurityTool/AndroidManifest.xml b/AndroidVendorSecurityTool/AndroidManifest.xml
deleted file mode 100644
index fa886b1..0000000
--- a/AndroidVendorSecurityTool/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.vending.sectool.v1"
- android:versionCode="23"
- android:versionName="3.3">
- <uses-sdk android:minSdkVersion="3" />
-
- <supports-screens
- android:smallScreens="true"
- android:normalScreens="true"
- android:largeScreens="true"
- android:anyDensity="true" />
-
- <uses-permission android:name="android.permission.INTERNET"/>
- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
- <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
- <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
-
- <application
- android:icon="@drawable/icon"
- android:label="@string/app_name">
-
- <service
- android:name="GoogleSecurityToolActivity" />
-
- <receiver
- android:name="GoogleSecurityToolReceiver">
- <intent-filter>
- <action android:name="android.intent.action.PACKAGE_ADDED"/>
- <action android:name="android.intent.action.PACKAGE_CHANGED"/>
- <action android:name="android.intent.action.PACKAGE_REMOVED"/>
- <data android:scheme="package" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.BOOT_COMPLETED"/>
- </intent-filter>
- <intent-filter>
- <action android:name="com.android.vending.INSTALL_REFERRER" />
- </intent-filter>
- <intent-filter>
- <action android:name="android.intent.action.GTALK_CONNECTED"/>
- </intent-filter>
- </receiver>
-
- </application>
-</manifest>
\ No newline at end of file
diff --git a/AndroidVendorSecurityTool/README b/AndroidVendorSecurityTool/README
deleted file mode 100644
index 74e58ee..0000000
--- a/AndroidVendorSecurityTool/README
+++ /dev/null
@@ -1,7 +0,0 @@
-AVST.apk:
-
-An app developed for removing the recent DroidDream malware
-from infected devices. Currently on market and pushed directly
-to affected devices.
-
-Owner: Erik Pasternak <epastern@google.com>
diff --git a/AndroidVendorSecurityTool/aliases b/AndroidVendorSecurityTool/aliases
deleted file mode 100644
index be0311c..0000000
--- a/AndroidVendorSecurityTool/aliases
+++ /dev/null
@@ -1,6 +0,0 @@
-alias aremount='(adb shell mount -o remount,rw /dev/block/mtdblock3 /system)'
-alias immune=' (adb root && sleep 1 && aremount && adb push empty /system/bin/profile && adb shell chown root /system/bin/profile && adb shell chmod 4755 /system/bin/profile)'
-alias other=' (adb root && sleep 1 && aremount && adb push other /system/bin/profile && adb shell chown root /system/bin/profile && adb shell chmod 4755 /system/bin/profile)'
-alias cpuns=' cp ${ANDROID_PRODUCT_OUT}/obj/APPS/AVST_intermediates/package.apk.unsigned'
-alias insavst=' (adb install -r ${ANDROID_PRODUCT_OUT}/system/app/AVST.apk)'
-alias rmavst=' (adb uninstall com.android.vending.sectool.v1)'
diff --git a/AndroidVendorSecurityTool/assets/droiddreamcleanall b/AndroidVendorSecurityTool/assets/droiddreamcleanall
deleted file mode 100644
index 6597362..0000000
--- a/AndroidVendorSecurityTool/assets/droiddreamcleanall
+++ /dev/null
Binary files differ
diff --git a/AndroidVendorSecurityTool/res/drawable/icon.png b/AndroidVendorSecurityTool/res/drawable/icon.png
deleted file mode 100644
index 075d908..0000000
--- a/AndroidVendorSecurityTool/res/drawable/icon.png
+++ /dev/null
Binary files differ
diff --git a/AndroidVendorSecurityTool/res/values/strings.xml b/AndroidVendorSecurityTool/res/values/strings.xml
deleted file mode 100644
index f49516a..0000000
--- a/AndroidVendorSecurityTool/res/values/strings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <!-- Name of the application [CHAR LIMIT=30]-->
- <string name="app_name">Android Market Security Tool March 2011</string>
-</resources>
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/BackendTest.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/BackendTest.java
deleted file mode 100644
index 8e50154..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/BackendTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package com.android.vending.sectool.v1;
-
-import android.content.Context;
-import android.content.res.AssetManager;
-import android.util.Log;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.util.zip.CRC32;
-
-public class BackendTest {
-
- public static boolean profileExists(File f) {
- return f.exists();
- }
-
- public static boolean isImmunized(File f) {
- long length = f.length();
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d("AVST", "length is " + length);
- return length == 0 || length == 8 || length == 28;
- }
-
- public static long profSize(File f) {
- return f.length();
- }
-
- public static boolean crcMatches(File f, long crc) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d("AVST", "Getting checksum");
- return getChecksum(f) == crc;
- }
-
- public static String runRemovalCommand(Context context, File f) {
- StringBuffer output = new StringBuffer();
- InputStream in = null;
- OutputStream os = null;
- try {
- AssetManager am = context.getAssets();
- in = am.open("droiddreamcleanall");
- output.append("aa");
- File location = context.getFileStreamPath("droiddreamclean");
- if (location.exists()) {
- location.delete();
- location.createNewFile();
- }
- os = new FileOutputStream(location);
- output.append("bb");
- byte[] buff = new byte[16000];
- int read;
- while ((read = in.read(buff)) > 0) {
- os.write(buff, 0, read);
- }
- os.close();
- in.close();
- output.append("cc");
- Runtime rt = Runtime.getRuntime();
- rt.exec("/system/bin/chmod 755 " + location.toString());
- output.append("dd");
- Process process = rt.exec(f.getAbsolutePath() + " -c "
- + location.toString());
- output.append("ee");
-
-// String removalCommand = "/system/bin/profile -c ls /";
-// Log.i(TAG, "command: " + removalCommand);
-// Process process = Runtime.getRuntime().exec(removalCommand);
-
- BufferedReader bReader = new BufferedReader(new InputStreamReader(process
- .getInputStream()));
- StringBuffer binOutput = new StringBuffer();
- char[] buffer = new char[4096];
- while ((read = bReader.read(buffer)) > 0) {
- binOutput.append(buffer, 0, read);
- }
- bReader.close();
- // Marks the start of our output, trim anything before it
- int elhIndex = binOutput.lastIndexOf("elh");
- if (elhIndex == -1) {
- elhIndex = 0;
- }
- output.append(binOutput.substring(elhIndex, binOutput.length()));
-
- process.waitFor();
- } catch (Exception e) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d(GoogleSecurityToolActivity.TAG, e.getMessage());
- output.append(e.getMessage());
- } finally {
-// if (os != null) {
-// os.close();
-// }
-// if (in != null) {
-// in.close();
-// }
- }
- return output.toString();
- }
-
- public static long getChecksum(File f) {
- try {
- FileInputStream in = new FileInputStream(f);
- CRC32 crc = new CRC32();
- byte[] bytes = new byte[8192];
- int byteCount;
- crc.reset();
- while ((byteCount = in.read(bytes)) > 0) {
- crc.update(bytes, 0, byteCount);
- }
- in.close();
- long sum = crc.getValue();
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d("AVST", "crc is --" + sum + "--");
- return sum;
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- return -1;
- }
-
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolActivity.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolActivity.java
deleted file mode 100644
index 6e437a1..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolActivity.java
+++ /dev/null
@@ -1,221 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package com.android.vending.sectool.v1;
-
-import android.app.IntentService;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.text.TextUtils;
-import android.util.Log;
-import android.widget.Button;
-import android.widget.TextView;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.List;
-
-public class GoogleSecurityToolActivity extends IntentService {
- static final String TAG = "AVST";
- protected static final boolean DEBUG = true;
-
- protected static final String KEY_STATE = "grt_state";
- protected static final String KEY_RESULT = "grt_result";
- protected static final String KEY_ATTEMPTS = "grt_attempts";
-
- private static final int INITIAL = 0;
- private static final int TOOL_FINISHED = 1;
- TextView mMessage;
- Button mButton;
- Resources mRes;
-
- public GoogleSecurityToolActivity() {
- super(TAG);
- }
-
- @Override
- protected void onHandleIntent(Intent intent) {
- if (DEBUG) Log.d(TAG, "Starting removal tool");
- SharedPreferences sp =
- getSharedPreferences(getPackageName(), 0);
- int state = sp.getInt(KEY_STATE, INITIAL);
- String result = null;
- boolean init = PostNotification.pushResult(this, "init" + state);
- if (DEBUG) {
- if (init) Log.d(TAG, "init send success");
- else Log.d(TAG, "init send failed");
- }
- int numBad = hasBadPackages();
- File f2 = new File("/system/bin/share");
- File f1 = new File("/system/bin/profile");
- if (numBad > 0 ||
- (BackendTest.profileExists(f1) && !BackendTest.isImmunized(f1)) ||
- (BackendTest.profileExists(f2) && !BackendTest.isImmunized(f2))) {
- state = INITIAL;
- }
- if (state == INITIAL) {
- if (DEBUG) Log.d(TAG, "Initial state, running tool");
- StringBuilder rlog = new StringBuilder();
- if (BackendTest.profileExists(f1) || BackendTest.profileExists(f2)) {
- boolean imm1 = false;
- boolean imm2 = false;
- boolean clean1 = false;
- boolean clean2 = false;
- if (BackendTest.profileExists(f1) && BackendTest.isImmunized(f1)) {
- rlog.append("1imm.");
- imm1 = true;
- }
- if (BackendTest.profileExists(f2) && BackendTest.isImmunized(f2)) {
- rlog.append("2imm.");
- imm2 = true;
- }
- if (!imm1 && BackendTest.profileExists(f1)) {
- if (BackendTest.crcMatches(f1, 1911844080l)) {
- rlog.append(BackendTest.runRemovalCommand(this, f1));
- clean1 = true;
- } else {
- rlog.append("1size." + BackendTest.profSize(f1) + ".");
- }
- }
- if (!imm2 && BackendTest.profileExists(f2)) {
- if (BackendTest.crcMatches(f2, 2504428926l)) {
- rlog.append(BackendTest.runRemovalCommand(this, f2));
- clean2 = true;
- } else {
- rlog.append("2size." + BackendTest.profSize(f2) + ".");
- }
- }
- if ((!BackendTest.profileExists(f1) || imm1) &&
- (!BackendTest.profileExists(f2) || imm2) &&
- (numBad = hasBadPackages()) == 0) {
- rlog.append("clean");
- } else {
- rlog.append(numBad + ".bad.packages");
- }
- result = rlog.toString();
- } else if (numBad > 0){
- if (DEBUG) Log.d(TAG, "Bad Packages but not infected, will try again later");
- result = "no.profile." + numBad + ".bad.packages";
- } else {
- result = "clean";
- }
- if (DEBUG) Log.d(TAG, result);
- state = TOOL_FINISHED;
- Editor edit = sp.edit();
- edit.putInt(KEY_STATE, state);
- edit.putString(KEY_RESULT, result);
- edit.commit();
- }
- if (state == TOOL_FINISHED) {
- if (DEBUG) Log.d(TAG, "Tool finished");
- if (result == null) {
- result = sp.getString(KEY_RESULT, "no results");
- }
- boolean success = PostNotification.pushResult(this, result);
- if (success){
- sp.edit().putInt(KEY_STATE, INITIAL).commit();
- if (TextUtils.equals(result, "clean")) {
- disableReceiver();
- }
- } else {
- if (DEBUG) Log.d(TAG, "Send failed");
- }
- }
- }
-
- private int hasBadPackages() {
- PackageManager pm = getPackageManager();
- List<PackageInfo> packages = pm.getInstalledPackages(0);
- HashMap<String, PackageInfo> map = new HashMap<String, PackageInfo>();
- if (DEBUG) Log.d(TAG, "Num Packages: " + packages.size());
- for (PackageInfo pi : packages) {
- map.put(pi.packageName.trim(), pi);
- }
- int count = 0;
- for (int i = 0; i < badPackages.length; i++) {
- if (map.containsKey(badPackages[i])) {
- if (DEBUG) Log.d(TAG, "contained package :" + badPackages[i]);
- count++;
- }
- }
- return count;
- }
-
- private void disableReceiver() {
- final ComponentName c = new ComponentName(this,
- GoogleSecurityToolReceiver.class.getName());
- getPackageManager().setComponentEnabledSetting(c,
- PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
- PackageManager.DONT_KILL_APP);
- if (true) Log.d(TAG, "Done");
- }
-
- private static final String[] badPackages = new String[] {
- "org.super.yellow4",
- "com.droid.publick.hotgirls",
- "com.super.free.sexringtones",
- "hot.goddchen.power.sexyvideos",
- "Super.mobi.eraser",
- "advanced.piano",
- "com.Funny.Face",
- "com.advanced.SoundManager",
- "com.advanced.scientific.calculator",
- "com.app.aun",
- "com.apps.tosd",
- "com.beauty.leg",
- "com.bubble",
- "com.dice.power",
- "com.dice.power.advanced",
- "com.dodge.game.fallingball",
- "com.droiddream.advancedtaskkiller1",
- "com.droiddream.android.afdvancedfm",
- "com.droiddream.barcodescanner",
- "com.droiddream.basketball",
- "com.droiddream.blueftp",
- "com.droiddream.bowlingtime",
- "com.droiddream.comparator",
- "com.droiddream.compasslevel",
- "com.droiddream.daltonismo",
- "com.droiddream.fallingball",
- "com.droiddream.game.omok",
- "com.droiddream.glowhockey",
- "com.droiddream.howtotie",
- "com.droiddream.lovePositions",
- "com.droiddream.musicbox",
- "com.droiddream.passwordsafe",
- "com.droiddream.pewpew",
- "com.droiddream.sexringtones",
- "com.droiddream.stopwatch",
- "com.droiddream.system.app.remover",
- "com.editor.photoenhance",
- "com.fall.down",
- "com.fall.soft.down",
- "com.free.chess",
- "com.free.game.finger",
- "com.hg.panzerpanic1",
- "com.hz.game.mrrunner1",
- "com.magic.spiral",
- "com.power.SuperSolo",
- "com.power.basketball",
- "com.power.demo.note",
- "com.power.magic.StrobeLight",
- "com.quick.Delete",
- "com.sex.japaneese.girls",
- "com.sexsound.hilton",
- "com.sexy.hotgirls",
- "com.sexy.legs",
- "com.spider.man",
- "com.super.mp3ringtone",
- "hot.goddchen.sexyvideos",
- "org.droiddream.yellow4",
- "power.nick.ypaint",
- "power.power.rate",
- "powerstudio.spiderman",
- "proscio.app.nick.ypaint",
- "super.sancron.ringtones.sexysb",
- };
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolReceiver.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolReceiver.java
deleted file mode 100644
index 8adba4a..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSecurityToolReceiver.java
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package com.android.vending.sectool.v1;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.util.Log;
-
-public class GoogleSecurityToolReceiver extends BroadcastReceiver {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d(GoogleSecurityToolActivity.TAG,
- "Got an intent, starting service" + intent.getAction());
- intent = new Intent(intent);
- intent.setClass(context, GoogleSecurityToolActivity.class);
- if (context.startService(intent) == null) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.e(GoogleSecurityToolActivity.TAG, "Can't start service");
- }
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSettingsContract.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSettingsContract.java
deleted file mode 100644
index b80850e..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GoogleSettingsContract.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc.
- *
- * 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.vending.sectool.v1;
-
-import android.content.ContentResolver;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.database.SQLException;
-import android.net.Uri;
-import android.provider.BaseColumns;
-import android.util.Log;
-
-/**
- * The GoogleSettings provider contains Google app/service specific preferences.
- *
- * This class is duplicated in vendor/google/frameworks/maps, see
- * http://b/2553658.
- */
-public final class GoogleSettingsContract {
-
- public static final String AUTHORITY = "com.google.settings";
-
- private static final String TAG = "GoogleSettings";
-
- /**
- * Common base for tables of name/value settings.
- */
- public static class NameValueTable implements BaseColumns {
- public static final String NAME = "name";
- public static final String VALUE = "value";
-
- protected static boolean putString(ContentResolver resolver, Uri uri,
- String name, String value) {
- // The database will take care of replacing duplicates.
- try {
- ContentValues values = new ContentValues();
- values.put(NAME, name);
- values.put(VALUE, value);
- resolver.insert(uri, values);
- return true;
- } catch (SQLException e) {
- Log.e(TAG, "Can't set key " + name + " in " + uri, e);
- return false;
- } catch (IllegalArgumentException e) {
- // ContentResolver.insert() throws IllegalArgumentException if there is no
- // provider for the URI.
- Log.e(TAG, "Can't set key " + name + " in " + uri, e);
- return false;
- }
- }
-
- public static Uri getUriFor(Uri uri, String name) {
- return Uri.withAppendedPath(uri, name);
- }
- }
-
- /**
- * "Partner" settings, Actually this is the only settings table, and
- * it gets used for general Google-specific settings. The fact that it's
- * called "Partner" is just a historical accident.
- */
- public static final class Partner extends NameValueTable {
- /**
- * Look up a name in the database.
- * @param resolver to access the database with
- * @param name to look up in the table
- * @return the corresponding value, or null if not present
- */
- public static String getString(ContentResolver resolver, String name) {
- String value = null;
- Cursor c = null;
- try {
- c = resolver.query(CONTENT_URI, new String[] { NameValueTable.VALUE },
- NameValueTable.NAME + "=?", new String[]{ name }, null);
- if (c != null && c.moveToNext()) value = c.getString(0);
- } catch (SQLException e) {
- // SQL error: return null, but don't cache it.
- Log.e(TAG, "Can't get key " + name + " from " + CONTENT_URI, e);
- } finally {
- if (c != null) c.close();
- }
- return value;
- }
-
- /**
- * Look up a name in the database
- * @param resolver to access the database
- * @param name to look up in the table
- * @param defaultValue value to set if not found in table
- * @return the value found in the table or default
- */
- public static String getString(ContentResolver resolver, String name, String defaultValue) {
- String value = getString(resolver, name);
- if (value == null) {
- value = defaultValue;
- }
-
- return value;
- }
-
- /**
- * Store a name/value pair into the database.
- * @param resolver to access the database with
- * @param name to store
- * @param value to associate with the name
- * @return true if the value was set, false on database errors
- */
- public static boolean putString(ContentResolver resolver,
- String name, String value) {
- return putString(resolver, CONTENT_URI, name, value);
- }
-
- /**
- * Store a name/value pair into the database.
- * @param resolver to access the database with
- * @param name to store
- * @param value to associate with the name
- * @return true if the value was set, false on database errors
- */
- public static boolean putInt(ContentResolver resolver,
- String name, int value) {
- return putString(resolver, name, String.valueOf(value));
- }
-
- /**
- * Look up the value for name in the database, convert it to an int using Integer.parseInt
- * and return it. If it is null or if a NumberFormatException is caught during the
- * conversion then return defValue.
- */
- public static int getInt(ContentResolver resolver, String name, int defValue) {
- String valString = getString(resolver, name);
- int value;
- try {
- value = valString != null ? Integer.parseInt(valString) : defValue;
- } catch (NumberFormatException e) {
- value = defValue;
- }
- return value;
- }
-
- /**
- * Look up the value for name in the database, convert it to a long using Long.parseLong
- * and return it. If it is null or if a NumberFormatException is caught during the
- * conversion then return defValue.
- */
- public static long getLong(ContentResolver resolver, String name, long defValue) {
- String valString = getString(resolver, name);
- long value;
- try {
- value = valString != null ? Long.parseLong(valString) : defValue;
- } catch (NumberFormatException e) {
- value = defValue;
- }
- return value;
- }
-
- /**
- * Construct the content URI for a particular name/value pair,
- * useful for monitoring changes with a ContentObserver.
- * @param name to look up in the table
- * @return the corresponding content URI, or null if not present
- */
- public static Uri getUriFor(String name) {
- return getUriFor(CONTENT_URI, name);
- }
-
- /**
- * The content:// style URL for this table
- */
- public static final Uri CONTENT_URI =
- Uri.parse("content://" + AUTHORITY + "/partner");
-
-
- /**
- * Partner Table Version
- */
-
- public static final String DATA_STORE_VERSION = "data_store_version";
-
- /**
- * Google Partner Client Id
- */
- public static final String CLIENT_ID = "client_id";
-
- /**
- * Voice Search Client Id
- */
-
- public static final String VOICESEARCH_CLIENT_ID = "voicesearch_client_id";
-
- /**
- * Google Mobile Maps Client Id
- */
- public static final String MAPS_CLIENT_ID = "maps_client_id";
-
- /**
- * Google YouTube App Client Id
- */
- public static final String YOUTUBE_CLIENT_ID = "youtube_client_id";
-
- /**
- * Android Market Client Id
- */
- public static final String MARKET_CLIENT_ID = "market_client_id";
-
- /**
- * True if user has opted in to network location service.
- */
- public static final String NETWORK_LOCATION_OPT_IN = "network_location_opt_in";
-
- /**
- * Flag for allowing Google services to use location information.
- * Type: int ( 0 = disallow, 1 = allow )
- */
- public static final String USE_LOCATION_FOR_SERVICES = "use_location_for_services";
-
- /**
- * RLZ is a tracking string used for ROI analysis. It is similar
- * to client id but more powerful. RLZ data enables ROI analysis in
- * Google's distribution business (Toolbar, Pack, iGoogle). It
- * explicitly ties the revenue received from distributed software to the
- * expense of distribution payments.
- */
- public static final String RLZ = "rlz";
-
- /**
- * The Logging ID (a unique 64-bit value) as a hex string.
- * Used as a pseudonymous identifier for logging.
- */
- public static final String LOGGING_ID2 = "logging_id2";
-
- /**
- * Opaque blob of data representing Market state (installed apps, etc).
- * Used to hand off this data to the checkin service for upload.
- */
- public static final String MARKET_CHECKIN = "market_checkin";
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/Gservices.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/Gservices.java
deleted file mode 100644
index bfc5567..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/Gservices.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2009 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.vending.sectool.v1;
-
-import android.content.ContentResolver;
-import android.database.ContentObserver;
-import android.database.Cursor;
-import android.net.Uri;
-import android.os.Handler;
-import android.os.Looper;
-import android.util.Log;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
-
-/**
- * Gservices provides access to a key-value store that is can be
- * updated remote (by the google checkin service).
- */
-public class Gservices {
- public static final String TAG = "Gservices";
-
- public static final String OVERRIDE_ACTION =
- "com.google.gservices.intent.action.GSERVICES_OVERRIDE";
- public static final String CHANGED_ACTION =
- "com.google.gservices.intent.action.GSERVICES_CHANGED";
-
- public final static Uri CONTENT_URI =
- Uri.parse("content://com.google.android.gsf.gservices");
- public final static Uri CONTENT_PREFIX_URI =
- Uri.parse("content://com.google.android.gsf.gservices/prefix");
-
- public static final Pattern TRUE_PATTERN =
- Pattern.compile("^(1|true|t|on|yes|y)$", Pattern.CASE_INSENSITIVE);
- public static final Pattern FALSE_PATTERN =
- Pattern.compile("^(0|false|f|off|no|n)$", Pattern.CASE_INSENSITIVE);
-
- private static ContentResolver sResolver;
- private static HashMap<String, String> sCache;
- private static Object sVersionToken;
-
- private static void ensureCacheInitializedLocked(final ContentResolver cr) {
- if (sCache == null) {
- sCache = new HashMap<String, String>();
- sVersionToken = new Object();
- sResolver = cr;
-
- // Create a thread to host a Handler for ContentObserver callbacks.
- // The callback will clear the cache to force the resolver to be consulted
- // on future gets. The version is also updated.
- new Thread() {
- public void run() {
- Looper.prepare();
- cr.registerContentObserver(CONTENT_URI, true,
- new ContentObserver(new Handler(Looper.myLooper())) {
- public void onChange(boolean selfChange) {
- synchronized (Gservices.class) {
- sCache.clear();
- sVersionToken = new Object();
- }
- } });
- Looper.loop();
- }
- }.start();
- }
- }
-
- /**
- * Look up a key in the database.
- * @param cr to access the database with
- * @param key to look up in the table
- * @param defValue the value to return if the value from the database is null
- * @return the corresponding value, or defValue if not present
- */
- public static String getString(ContentResolver cr, String key, String defValue) {
- final Object version;
- synchronized (Gservices.class) {
- ensureCacheInitializedLocked(cr);
- version = sVersionToken;
- if (sCache.containsKey(key)) {
- String value = sCache.get(key);
- return (value != null) ? value : defValue;
- }
- }
- Cursor cursor = sResolver.query(CONTENT_URI, null, null, new String[]{ key }, null);
- if (cursor == null) return defValue;
-
- try {
- cursor.moveToFirst();
- String value = cursor.getString(1);
- synchronized (Gservices.class) {
- // There is a chance that the version change, and thus the cache clearing,
- // happened after the query, meaning the value we got could be stale. Don't
- // store it in the cache in this case.
- if (version == sVersionToken) {
- sCache.put(key, value);
- }
- }
- return (value != null) ? value : defValue;
- } finally {
- cursor.close();
- }
- }
-
- /**
- * Look up a key in the database.
- * @param cr to access the database with
- * @param key to look up in the table
- * @return the corresponding value, or null if not present
- */
- public static String getString(ContentResolver cr, String key) {
- return getString(cr, key, null);
- }
-
- /**
- * Look up the value for key in the database, convert it to an int
- * using Integer.parseInt and return it. If it is null or if a
- * NumberFormatException is caught during the conversion then
- * return defValue.
- */
- public static int getInt(ContentResolver cr, String key, int defValue) {
- String valString = getString(cr, key);
- int value;
- try {
- value = valString != null ? Integer.parseInt(valString) : defValue;
- } catch (NumberFormatException e) {
- value = defValue;
- }
- return value;
- }
-
- /**
- * Look up the value for key in the database, convert it to a long
- * using Long.parseLong and return it. If it is null or if a
- * NumberFormatException is caught during the conversion then
- * return defValue.
- */
- public static long getLong(ContentResolver cr, String key, long defValue) {
- String valString = getString(cr, key);
- long value;
- try {
- value = valString != null ? Long.parseLong(valString) : defValue;
- } catch (NumberFormatException e) {
- value = defValue;
- }
- return value;
- }
-
- public static boolean getBoolean(ContentResolver cr, String key, boolean defValue) {
- String valString = getString(cr, key);
- if (valString == null || valString.equals("")) {
- return defValue;
- } else if (TRUE_PATTERN.matcher(valString).matches()) {
- return true;
- } else if (FALSE_PATTERN.matcher(valString).matches()) {
- return false;
- } else {
- // Log a possible app bug
- Log.w(TAG, "attempt to read gservices key " + key + " (value \"" +
- valString + "\") as boolean");
- return defValue;
- }
- }
-
- /**
- * Look up values for all keys beginning with any of the given prefixes.
- *
- * @return a Map<String, String> of the matching key-value pairs.
- */
- public static Map<String, String> getStringsByPrefix(ContentResolver cr,
- String... prefixes) {
- Cursor c = cr.query(CONTENT_PREFIX_URI, null, null, prefixes, null);
- TreeMap<String, String> out = new TreeMap<String, String>();
- if (c == null) return out;
-
- try {
- while (c.moveToNext()) {
- out.put(c.getString(0), c.getString(1));
- }
- } finally {
- c.close();
- }
- return out;
- }
-
- /**
- * Returns a token that represents the current version of the data within gservices
- * @param cr the ContentResolver that Gservices should use to fill its cache
- * @return an Object that represents the current version of the Gservices values.
- */
- public static Object getVersionToken(ContentResolver cr) {
- synchronized (Gservices.class) {
- // Even though we don't need the cache itself, we need the cache version, so we make
- // that the cache has been initialized before we return its version.
- ensureCacheInitializedLocked(cr);
- return sVersionToken;
- }
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GservicesValue.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GservicesValue.java
deleted file mode 100644
index 63e4ef9..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/GservicesValue.java
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package com.android.vending.sectool.v1;
-
-import com.android.vending.sectool.v1.GoogleSettingsContract;
-import com.android.vending.sectool.v1.Gservices;
-
-import android.app.Application;
-import android.content.ContentResolver;
-import android.content.Context;
-
-/**
- * A convenient way to read Gservices values, inspired by Flag.
- *
- * You must call {@link #init(Context)} before any calls to {@link #get()}.
- * The recommended place to call this is in {@link Application#onCreate()}.
- */
-public abstract class GservicesValue<T> {
- private static GservicesReader sGservicesReader = null;
-
- public static void init(Context context) {
- sGservicesReader = new GservicesReaderImpl(context.getContentResolver());
- }
-
- public static void initForTests() {
- sGservicesReader = new GservicesReaderForTests();
- }
-
- protected final String mKey;
- protected final T mDefaultValue;
- private T mOverride = null;
-
- protected GservicesValue(String key, T defaultValue) {
- mKey = key;
- mDefaultValue = defaultValue;
- }
-
- /** For tests. */
- public void override(T value) {
- mOverride = value;
- }
-
- protected abstract T retrieve(String key);
-
- public final T get() {
- if (mOverride != null) {
- return mOverride;
- }
- return retrieve(mKey);
- }
-
- public static GservicesValue<Boolean> value(String key, boolean defaultValue) {
- return new GservicesValue<Boolean>(key, defaultValue) {
- @Override
- protected Boolean retrieve(String key) {
- return sGservicesReader.getBoolean(mKey, mDefaultValue);
- }
- };
- }
-
- public static GservicesValue<Long> value(String key, Long defaultValue) {
- return new GservicesValue<Long>(key, defaultValue) {
- @Override
- protected Long retrieve(String key) {
- return sGservicesReader.getLong(mKey, mDefaultValue);
- }
- };
- }
-
- public static GservicesValue<Integer> value(String key, Integer defaultValue) {
- return new GservicesValue<Integer>(key, defaultValue) {
- @Override
- protected Integer retrieve(String key) {
- return sGservicesReader.getInt(mKey, mDefaultValue);
- }
- };
- }
-
- public static GservicesValue<String> value(String key, String defaultValue) {
- return new GservicesValue<String>(key, defaultValue) {
- @Override
- protected String retrieve(String key) {
- return sGservicesReader.getString(mKey, mDefaultValue);
- }
- };
- }
-
- public static GservicesValue<String> partnerSetting(String key, String defaultValue) {
- return new GservicesValue<String>(key, defaultValue) {
- @Override
- protected String retrieve(String key) {
- return sGservicesReader.getPartnerString(mKey, mDefaultValue);
- }
- };
- }
-
-
- private interface GservicesReader {
- public Boolean getBoolean(String key, Boolean defaultValue);
- public Long getLong(String key, Long defaultValue);
- public Integer getInt(String key, Integer defaultValue);
- public String getString(String key, String defaultValue);
- public String getPartnerString(String key, String defaultValue);
- }
-
- /** The real Gservices reader. */
- private static class GservicesReaderImpl implements GservicesReader {
- private final ContentResolver mContentResolver;
- public GservicesReaderImpl(ContentResolver contentResolver) {
- mContentResolver = contentResolver;
- }
-
- public Boolean getBoolean(String key, Boolean defaultValue) {
- return Gservices.getBoolean(mContentResolver, key, defaultValue);
- }
-
- public Integer getInt(String key, Integer defaultValue) {
- return Gservices.getInt(mContentResolver, key, defaultValue);
- }
-
- public Long getLong(String key, Long defaultValue) {
- return Gservices.getLong(mContentResolver, key, defaultValue);
- }
-
- public String getString(String key, String defaultValue) {
- return Gservices.getString(mContentResolver, key, defaultValue);
- }
-
- public String getPartnerString(String key, String defaultValue) {
- return GoogleSettingsContract.Partner.getString(mContentResolver, key, defaultValue);
- }
- }
-
- /** Implementation of GservicesReader for testing. */
- private static class GservicesReaderForTests implements GservicesReader {
- public Boolean getBoolean(String key, Boolean defaultValue) { return defaultValue; }
- public Integer getInt(String key, Integer defaultValue) { return defaultValue; }
- public Long getLong(String key, Long defaultValue) { return defaultValue; }
- public String getString(String key, String defaultValue) { return defaultValue; }
- public String getPartnerString(String key, String defaultValue) { return defaultValue; }
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/PostNotification.java b/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/PostNotification.java
deleted file mode 100644
index bfc4517..0000000
--- a/AndroidVendorSecurityTool/src/com/android/vending/sectool/v1/PostNotification.java
+++ /dev/null
@@ -1,261 +0,0 @@
-// Copyright 2011 Google Inc. All Rights Reserved.
-
-package com.android.vending.sectool.v1;
-
-import org.apache.http.StatusLine;
-import org.apache.http.client.ClientProtocolException;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.params.ClientPNames;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.ClientConnectionManagerFactory;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.SingleClientConnManager;
-import org.apache.http.params.HttpParams;
-
-import android.content.Context;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.net.Uri;
-import android.provider.Settings.Secure;
-import android.telephony.TelephonyManager;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.google.android.googlelogin.GoogleLoginServiceBlockingHelper;
-import com.google.android.googlelogin.GoogleLoginServiceNotFoundException;
-
-import java.io.IOException;
-import java.net.URI;
-
-public class PostNotification {
-
- private static final int FAIL = 0;
- private static final int IMMUNE = 1;
- private static final int INIT = 2;
- private static final int CLEAN = 3;
-
- public static boolean pushResult(Context context, String result) {
- TelephonyManager telephonyManager = (TelephonyManager) context
- .getSystemService(Context.TELEPHONY_SERVICE);
- String aid = getAndroidId(context);
- String idString;
- String imeiMeid = telephonyManager.getDeviceId();
- int type = telephonyManager.getPhoneType();
- if (type == TelephonyManager.PHONE_TYPE_GSM){
- idString = "id2";
- } else if (type == TelephonyManager.PHONE_TYPE_NONE) {
- idString = "id4";
- } else {
- idString = "id3";
- }
-
- Uri.Builder ub = Uri.parse("https://android.clients.google.com/market/").buildUpon();
-// Uri.Builder ub = Uri.parse("https://android.clients.google.com/fdfe/").buildUpon();
-
- if (!TextUtils.isEmpty(aid)) {
- ub.appendQueryParameter("id1", aid);
- }
- ub.appendQueryParameter(idString, imeiMeid);
- ub.appendQueryParameter("log", result);
-
- int code = FAIL;
-
- String urlString = ub.build().toString();
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, "origUrl: " + urlString);
- }
-
- urlString = urlString.replaceAll("Success", "S");
- // If the package manager recognizes the app has been removed
- // before we tell it to uninstall it will report failure
- // since it won't have the app listed anymore. We should
- // silently ignore this specific failure.
- urlString = urlString.replaceAll("rm%20ammanager%3AS%0Apm%20uninst%20ammanager%3AFailure",
- "ammS");
- urlString = urlString.replaceAll(
- "rm%20DownloadProvidersManager%3AS%0Apm%20uninst%20downloadsmanager%3AFailure",
- "dlmS");
- urlString = urlString.replaceAll(
- "DownloadProvidersManager%3AFailure%20errorno%3DNo%20such%20file", "dlpf");
- String urlString2 = urlString.replaceAll("Failure", "F");
- if (TextUtils.equals(urlString, urlString2)) {
- code = CLEAN;
- }
- urlString = urlString2;
- urlString = urlString.replaceAll("%20", ".");
- urlString = urlString.replaceAll("%0A", "");
- urlString = urlString.replaceAll("%3A", "");
-
- if (!urlString.endsWith("clean")) {
- if (result.startsWith("init")) {
- code = INIT;
- } else {
- code = FAIL;
- }
- } else if (result.startsWith("1imm") || result.startsWith("2imm")) {
- code = IMMUNE;
- }
-
- if (urlString.length() > 1950) {
- urlString = TextUtils.substring(urlString,0,1950);
- }
- if (code == CLEAN) {
- urlString += "&result=clean";
- } else if (code == IMMUNE) {
- urlString += "&result=imm";
- } else if (code == INIT) {
- urlString += "&result=init";
- } else {
- urlString += "&result=fail";
- }
- try {
- urlString += "&v=" + context.getPackageManager()
- .getPackageInfo(context.getPackageName(), 0).versionCode;
- } catch (NameNotFoundException e1) {
- urlString += "&v=unk";
- e1.printStackTrace();
- }
- if (GoogleSecurityToolActivity.DEBUG) {
- urlString += "D";
- }
- int index = urlString.lastIndexOf('%');
- if (index > urlString.length() - 6) {
- urlString = TextUtils.substring(urlString, 0, index);
- }
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, urlString);
- }
-
- HttpGet httpGet = new HttpGet(URI.create(urlString));
-
- try {
-
- DefaultHttpClient httpClient = new SectoolHttpsClient();
-
- StatusLine response = httpClient.execute(httpGet).getStatusLine();
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, response.toString());
- }
-
- int statusCode = response.getStatusCode();
- return statusCode >= 200 && statusCode < 300;
-
- } catch (ClientProtocolException e) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d(GoogleSecurityToolActivity.TAG, "cpe " + e.getMessage());
- } catch (IOException e) {
- if (GoogleSecurityToolActivity.DEBUG)
- Log.d(GoogleSecurityToolActivity.TAG, "io " + e.getMessage());
- }
- return false;
- }
-
- private static String getAndroidId(Context context) {
- final boolean TRY_THEM_ALL = GoogleSecurityToolActivity.DEBUG;
- String androidId = null;
-
- // //////////////////////
- // Froyo and up
- // //////////////////////
- GservicesValue.init(context);
- GservicesValue<Long> gsv = GservicesValue.value("android_id", 0L);
- Long aidF = gsv.get();
- if (aidF != null && aidF != 0) {
- androidId = Long.toHexString(aidF);
- }
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, " F-aId:" + androidId);
- }
-
- // //////////////////////
- // Eclair
- // //////////////////////
- if (TRY_THEM_ALL || TextUtils.isEmpty(androidId)) {
- String temp = null;
- try {
- long aidE = GoogleLoginServiceBlockingHelper.getAndroidId(context);
- if (aidE != 0) {
- temp = Long.toHexString(aidE);
- if (androidId == null) androidId = temp;
- }
- } catch (GoogleLoginServiceNotFoundException e) {
- Log.e(GoogleSecurityToolActivity.TAG, e.toString());
- }
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, " E-aId:" + temp);
- }
-
- }
-
- // //////////////////////
- // Secure.getString
- // //////////////////////
- if (TRY_THEM_ALL || TextUtils.isEmpty(androidId)) {
- String temp = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
- if (androidId == null) androidId = temp;
-
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, " S-aId:" + temp);
- }
- }
- if (GoogleSecurityToolActivity.DEBUG) {
- Log.d(GoogleSecurityToolActivity.TAG, "androidId:" + androidId);
- }
- return androidId;
- }
-
- private static class SectoolHttpsClient extends DefaultHttpClient {
- @Override
- protected ClientConnectionManager createClientConnectionManager() {
- SchemeRegistry registry = new SchemeRegistry();
- registry.register(
- new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
- SSLSocketFactory sslf = SSLSocketFactory.getSocketFactory();
- sslf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
- Scheme scheme = new Scheme("https", sslf, 443);
- registry.register(scheme);
-
- ClientConnectionManager connManager = null;
- HttpParams params = getParams();
-
- ClientConnectionManagerFactory factory = null;
-
- // Try first getting the factory directly as an object.
- factory = (ClientConnectionManagerFactory) params
- .getParameter(ClientPNames.CONNECTION_MANAGER_FACTORY);
- if (factory == null) { // then try getting its class name.
- String className = (String) params.getParameter(
- ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
- if (className != null) {
- try {
- Class<?> clazz = Class.forName(className);
- factory = (ClientConnectionManagerFactory) clazz.newInstance();
- } catch (ClassNotFoundException ex) {
- throw new IllegalStateException("Invalid class name: " + className);
- } catch (IllegalAccessException ex) {
- throw new IllegalAccessError(ex.getMessage());
- } catch (InstantiationException ex) {
- throw new InstantiationError(ex.getMessage());
- }
- }
- }
-
- if(factory != null) {
- connManager = factory.newInstance(params, registry);
- } else {
- connManager = new SingleClientConnManager(getParams(), registry);
- }
-
- return connManager;
- }
- }
-
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.aidl b/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.aidl
deleted file mode 100644
index dbb2f97..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2007 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.google.android.googleapps;
-
-parcelable GoogleLoginCredentialsResult;
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.java b/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.java
deleted file mode 100644
index ced05ce..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googleapps/GoogleLoginCredentialsResult.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2007 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.google.android.googleapps;
-
-import android.content.Intent;
-import android.os.Parcel;
-import android.os.Parcelable;
-
-/**
- * "Result" container class returned by the GoogleLoginService
- * {@link IGoogleLoginService#blockingGetCredentials} or
- * {@link IGoogleLoginService#retryGetCredentials} request.
- * <p>
- * A single credentials request can <b>either</b>
- * <ol>
- * <li> instantly return the credentials you asked for
- * (ie. an authentication token, which is a String)
- * <p> <b>or</b>
- * <li> return an Intent which you (the caller) need to run yourself
- * using {@link android.app.Activity#startActivityForResult},
- * which will then return the credentials you asked
- * for to your <code>onActivityResult</code> method.
- * <p>
- * (Generally, that Intent will bring up a UI for the user to
- * enter their username and password. The IGoogleLoginService
- * interface doesn't guarantee anything about what that Intent
- * actually does, though.)
- * </ol>
- * This class can encapsulate either result. Call <code>getCredentialsString</code> or
- * <code>getCredentialsIntent</code> on the returned object; one will return a non-null
- * value.
- */
-public class GoogleLoginCredentialsResult implements Parcelable {
- private String mAccount;
- private String mCredentialsString;
- private Intent mCredentialsIntent;
-
- /**
- * Gets the account for which you asked for credentials.
- */
- public String getAccount() {
- return mAccount;
- }
-
- /**
- * Gets the authentication token representing the credentials you asked for.
- * <p>
- * Either this or <code>getCredentials</code> will return a non-null value on the object
- * returned from a credentials request.
- */
- public String getCredentialsString() {
- return mCredentialsString;
- }
-
- /**
- * Gets the Intent which the caller needs to run in order
- * to get the requested credentials.
- * <p>
- * With a GoogleLoginCredentialsResult object returned by the
- * GoogleLoginService <code>getCredentials</code> method, either this or
- * <code>getCredentialsString</code> (but not both) will return non-null.
- */
- // TODO: better name? "getCredentialsLookupIntent"?
- public Intent getCredentialsIntent() {
- return mCredentialsIntent;
- }
-
- /**
- * {@hide}
- * Create an empty GoogleLoginCredentialsResult.
- */
- public GoogleLoginCredentialsResult() {
- mCredentialsString = null;
- mCredentialsIntent = null;
- mAccount = null;
- }
-
- /** {@hide} */
- public void setCredentialsString(String s) {
- mCredentialsString = s;
- }
-
- /** {@hide} */
- public void setCredentialsIntent(Intent intent) {
- mCredentialsIntent = intent;
- }
-
- /** {@hide} */
- public void setAccount(String account) {
- mAccount = account;
- }
-
- //
- // Parcelable interface
- //
-
- public int describeContents() {
- return (mCredentialsIntent != null) ? mCredentialsIntent.describeContents() : 0;
- }
-
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(mAccount);
- out.writeString(mCredentialsString);
- if (mCredentialsIntent != null) {
- out.writeInt(1);
- mCredentialsIntent.writeToParcel(out, 0);
- } else {
- out.writeInt(0);
- }
- }
-
- public static final Parcelable.Creator<GoogleLoginCredentialsResult> CREATOR
- = new Parcelable.Creator<GoogleLoginCredentialsResult>() {
- public GoogleLoginCredentialsResult createFromParcel(Parcel in) {
- return new GoogleLoginCredentialsResult(in);
- }
-
- public GoogleLoginCredentialsResult[] newArray(int size) {
- return new GoogleLoginCredentialsResult[size];
- }
- };
-
- private GoogleLoginCredentialsResult(Parcel in) {
- readFromParcel(in);
- }
-
- public void readFromParcel(Parcel in) {
- mAccount = in.readString();
- mCredentialsString = in.readString();
-
- int hasIntent = in.readInt();
- mCredentialsIntent = null;
- if (hasIntent == 1) {
- mCredentialsIntent = new Intent();
- mCredentialsIntent.readFromParcel(in);
- mCredentialsIntent.setExtrasClassLoader(getClass().getClassLoader());
- }
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googleapps/IGoogleLoginService.aidl b/AndroidVendorSecurityTool/src/com/google/android/googleapps/IGoogleLoginService.aidl
deleted file mode 100644
index 0e60a1d..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googleapps/IGoogleLoginService.aidl
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (C) 2007 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.google.android.googleapps;
-
-import com.google.android.googleapps.GoogleLoginCredentialsResult;
-import com.google.android.googleapps.LoginData;
-
-
-/**
- * Central application service used by Google apps to acquire login
- * credentials for all Google services.
- * <p>
- * See {@link GoogleLoginServiceHelper} and
- * {@link GoogleLoginServiceSynchronousHelper} for convenience wrappers
- * around the sequence of binding to the service and then
- * making API calls.
- */
-interface IGoogleLoginService {
- /**
- * Gets the list of Google Accounts the user has previously logged
- * in to. Accounts are of the form "username@domain".
- * <p>
- * This method will return an empty array if the device doesn't
- * know about any Google accounts (yet). In this case, if the
- * caller is an application (rather than a background task), the
- * typical next step is to call {@link #blockingGetCredentials}
- * with a null account; this will return an Intent that,
- * if run using {@link android.app.Activity#startSubActivity startSubActivity},
- * will prompt the user for username/password and ultimately
- * return an authentication token for the desired service.
- *
- * @return The accounts. The array will be zero-length if the
- * GoogleLoginService doesn't know about any accounts yet.
- */
- String[] getAccounts();
-
- /**
- * @deprecated
- *
- * Now equivalent to <code>getAccount(false)</code>.
- */
- String getPrimaryAccount();
-
- /**
- * Get the account to use on this device.
- *
- * @param requireGoogle true if you need the device's Google
- * (non-hosted domain) account.
- *
- * @return username of the account
- */
- String getAccount(boolean requireGoogle);
-
- /**
- * Retrieves the credentials for a given account and service
- * <i>only if</i> the device already has a cached authentication token for that
- * account/service.
- * <p>
- * This method will <i>not</i> do any network I/O, even in the case
- * where we have no auth token for the specified service but we do
- * have a password for the specified account.
- * (Use {@link #blockingGetCredentials} if you do want to allow
- * the GoogleLoginService to use the network to fetch a fresh
- * auth token in this case.)
- * <p>
- * Note that the GoogleLoginService caches auth tokens
- * indefinitely, but the tokens themselves may expire over time.
- * Thus, the auth token returned by this method is <i>not</i>
- * guaranteed to be valid (since we'd need to do network I/O to
- * check that!)
- * <p>
- * The account and service parameters are the same as in
- * the {@link #blockingGetCredentials} call.
- *
- * @return An authentication token for the desired username/service,
- * or null if the device doesn't have a
- * cached auth token for that username/service.
- */
- String peekCredentials(String username, String service);
-
-
- /**
- * Retrieves the credentials for a given account and service.
- * <p>
- * This method will <b>either</b>
- * <ol>
- * <li> return an authentication token for the specified account/service
- * <p> <b>or</b>
- * <li> return an Intent which you (the caller) need to run
- * yourself using {@link android.app.Activity#startSubActivity startSubActivity},
- * which will ultimately return the desired
- * auth token to your <code>onActivityResult</code> method.
- * <br>
- * (Generally, that Intent will bring up a UI for the user to
- * enter their username and password, but the
- * IGoogleLoginService interface deliberately doesn't specify
- * exactly what that Intent will do.)
- * </ol>
- * The {@link GoogleLoginCredentialsResult} class encapsulates these two
- * possible results: either the <code>getCredentialsString</code> method will
- * return an auth token (in case (1) above), or the
- * <code>getCredentialsIntent</code> method will return the Intent you need
- * to run to prompt the user (in case (2)).
- * <p>
- * This method will never return a GoogleLoginCredentialsResult
- * object where <i>both</i> <code>getCredentialsString()</code> and
- * <code>getCredentialsIntent()</code> return non-null.
- * <p>
- * Other notes:
- * <ul>
- * <li> In case (1) this method may block to do network I/O!
- * Use {@link #peekCredentials} instead if you need to quickly check
- * whether the device has a cached auth token for a given
- * account/service.
- * <p>
- * <li> In case (2), if it's appropriate to interact with the user at
- * the current time, the caller should run the returned Intent as
- * a sub-activity.
- * When that sub-activity returns, the resulting "extras" Bundle
- * (which will be returned to the caller's <code>onActivityResult</code>
- * method) will contain the following two mappings <i>if</i> we
- * were able to successfully log in to the specified
- * account/service:
- * <ul>
- * <li>key = {@link GoogleLoginServiceConstants#AUTHTOKEN_KEY
- * GoogleLoginServiceConstants.AUTHTOKEN_KEY}
- * <li>value = Auth token for the specified account/service (String)
- * </ul>
- * and
- * <ul>
- * <li>key = {@link GoogleLoginServiceConstants#AUTH_ACCOUNT_KEY
- * GoogleLoginServiceConstants.AUTH_ACCOUNT_KEY}
- * <li>value = Account name used to generate the above auth token (String),
- * which will probably be useful if you initially
- * called <code>blockingGetCredentials</code> with a null account name.
- * </ul>
- * <p>
- * Note: if the caller's <code>onActivityResult</code> method is called with
- * a null "extras" Bundle, or a resultCode of RESULT_CANCELED,
- * that means that we weren't able to authenticate.
- * Either the user bailed out without entering a
- * username+password at all, or there was some failure during
- * the authentication process.
- * <p>
- * <li>If your application simply wants to "log into an account
- * without ever prompting the user", like in the (very common)
- * case of a background task or sync adapter, you can simply
- * handle case (2) by not doing anything at all (other than maybe
- * displaying a "couldn't log in" status somewhere in your UI.)
- * <p>
- * <li>See {@link GoogleLoginServiceHelper#getCredentials
- * GoogleLoginServiceHelper.getCredentials} for a static
- * convenience wrapper around this entire sequence.
- * </ul>
- *
- * @param account The account to obtain the credentials for.
- * This should either be one of the accounts returned by
- * the <code>getAccounts</code> call, or null.
- * <br>
- * The account will typically be null in the
- * case where there the device doesn't know about
- * any accounts yet, or also in the case where
- * an application needs to log into a new account;
- * a null account here guarantees that we'll
- * need to prompt the user for username/password.
- * <br>
- * UI note: In the case where we return an Intent
- * to prompt the user for username/password, that
- * UI will automatically assume a domain name
- * (usually "@gmail.com", but which may vary
- * depending on the specified service) if the user
- * enters a username with no domain.
- *
- * @param service The service to log in to, like "cl" (Calendar)
- * or "mail" (GMail) or "blogger" (Blogger).
- * (See the API documentation for your specific
- * service to find out what service name to use
- * here.)
- * <br>
- * If null, the resulting authentication token will
- * be "non-compartmentalized" (and will work across
- * all non-compartmentalized Google services.)
- *
- * @param notifyAuthFailure if true, we will put up a status bar
- * notification if the attempt get the auth token
- * over the network fails because the password is
- * invalid (or because the password is blank).
- *
- * @return The results: either the requested credentials,
- * or an Intent that your app can run to get them.
- */
- GoogleLoginCredentialsResult blockingGetCredentials(
- String username, String service, boolean notifyAuthFailure);
-
- /**
- * Invalidates the specified authentication token. The next time
- * this token is requested it will be reauthenticated.
- * <p>
- * Background: the auth tokens returned from <code>peekCredentials()</code> or
- * <code>blockingGetCredentials()</code> are <i>not</i> guaranteed to be
- * valid, mainly because a token cached in the device's database may
- * have expired since we last tried to use it. (Most auth tokens expire
- * after some amount of time, but the GoogleLoginService itself can't tell
- * when or if a given auth token will expire. Only the Google service
- * your application talks to can say for sure whether a given auth token
- * is still valid.)
- * <p>
- * So if you do get an authentication error (from your app's service) when
- * using an auth token that came from the GoogleLoginService, you should
- * tell the GoogleLoginService about it by passing the failed token to
- * this method. After doing that, you can get a fresh token by making
- * another <code>blockingGetCredentials()</code> call (or
- * <code>getCredentials()</code> if using a helper class like
- * <code>GoogleLoginServiceHelper</code>).
- *
- * @param authTokenToInvalidate The auth token to invalidate.
- */
- void invalidateAuthToken(String authTokenToInvalidate);
-
- /**
- * Returns the "Android ID", a 64-bit value unique to this device
- * assigned when the device is first registered with Google.
- *
- * Returns 0 if the device is not registered, or if the Android ID
- * is unavailable for any reason. This call never blocks for
- * network activity.
- */
- long getAndroidId();
-
- // --------------------------------------------------------
- // methods below this point require the
- // com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD
- // permission, and will fail if the caller does not have it.
- // --------------------------------------------------------
-
- /**
- * Try logging in to a new account.
- *
- * On calling, data should contain username, password, (optional)
- * captcha token and answer. flags should be 0 to allow any
- * account, or FLAG_GOOGLE_ACCOUNT to require a google account.
- *
- * The possible values of data.mStatus on return are described by
- * the {@link LoginData.Status} enum.
- *
- * If status is CAPTCHA, the captcha token, data, and mime type
- * fields will be filled in.
- */
- void tryNewAccount(inout LoginData data);
-
- /**
- * Save a new account to the database. data should be an object
- * previously passed to tryNewAccount, with status SUCCESS.
- */
- void saveNewAccount(in LoginData data);
-
- /**
- * Store an auth token into the database. Has no effect if
- * account is not in the database.
- */
- void saveAuthToken(String username, String service, String authToken);
-
- /**
- * Try to obtain an authtoken for the username and service in
- * data, using the password in data. If successful, save the
- * password in the database (and return the authtoken).
- *
- * If the password in data is null, erases the password and all
- * authtokens for the account from the database.
- *
- * username must already exist in the database, or a status of
- * BAD_REQUEST will be returned.
- */
- void updatePassword(inout LoginData data);
-
- /**
- * Returns true if the given username/password match one stored in
- * the login service. This does <i>not</i> do any network
- * activity; it does not check that the password is valid on
- * Google's servers, only that it matches what is stored on the
- * device.
- */
- boolean verifyStoredPassword(String username, String password);
-
- // --------------------------------------------------------
- // methods below this point exist primarily for automated tests.
- // --------------------------------------------------------
-
- /**
- * Add a new username/password pair to the Google Login Service.
- * Does not test to see if they are valid; just puts them directly
- * in the database.
- *
- * @param account the username (email address) of the account to add
- * @param password the password for this new account
- */
- void saveUsernameAndPassword(String username, String password, int flags);
-
- /**
- * Remove an account and all its authtokens from the database.
- *
- * @param account the account to remove
- */
- void deleteOneAccount(String username);
-
- /**
- * Remove all accounts and authtokens from the database.
- */
- void deleteAllAccounts();
-
- /**
- * Cause the device to register and get an android ID.
- * @return If LoginData.Status were an int we could return that. Instead
- * we return:
- * 0 - success
- * 1 - login failure (caller should ask for a new password)
- * 2 - NOT IMPLEMENTED - CAPTCHA required?
- * -1 - network or other transient failure (caller should try again, with a backoff)
- */
- int waitForAndroidId();
-
- // TODO: The aidl compiler might let you define constants (static
- // member variables) one of these days, rather than just letting
- // you declare member functions.
- //
- // When/if that happens, I should consider adding a section to
- // this aidl file for "Miscellaneous constants used by the
- // GoogleLoginService and related helper classes", containing the
- // constants currently found in the GoogleLoginServiceConstants
- // class (which can then be deleted.)
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.aidl b/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.aidl
deleted file mode 100644
index 090ed93..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.aidl
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2008 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.google.android.googleapps;
-
-parcelable LoginData;
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.java b/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.java
deleted file mode 100644
index dc4a2da..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googleapps/LoginData.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2008 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.google.android.googleapps;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-
-public class LoginData implements Parcelable {
-
- /*
- * NOTE: DO NOT MODIFY THIS! Any modifications will result in an
- * incompatible API for third-party apps that have the Google login client
- * statically linked in.
- */
- public enum Status {
- SUCCESS,
- ACCOUNT_DISABLED, // the account has been disabled by google
- BAD_USERNAME, // remember, usernames must include the domain
- BAD_REQUEST, // server couldn't parse our request
- LOGIN_FAIL, // username/pw invalid, account disabled, account not verified
- SERVER_ERROR, // error on the server side
- MISSING_APPS, // dasher account has mail, calendar, talk disabled
- NO_GMAIL, // this is a foreign account
- NETWORK_ERROR, // can't reach the server
- CAPTCHA, // server requires a captcha
- CANCELLED, // user cancelled request in progress
- DELETED_GMAIL, // foreign account has gmail, but it's been disabled
- };
-
- public String mUsername = null;
- public String mEncryptedPassword = null;
- public String mPassword = null;
- public String mService = null;
- public String mCaptchaToken = null;
- public byte[] mCaptchaData = null;
- public String mCaptchaMimeType = null;
- public String mCaptchaAnswer = null;
- public int mFlags = 0;
- public Status mStatus = null;
- public String mJsonString = null;
- public String mSid = null;
- public String mAuthtoken = null;
-
- public LoginData() { }
-
- public LoginData(LoginData other) {
- this.mUsername = other.mUsername;
- this.mEncryptedPassword = other.mEncryptedPassword;
- this.mPassword = other.mPassword;
- this.mService = other.mService;
- this.mCaptchaToken = other.mCaptchaToken;
- this.mCaptchaData = other.mCaptchaData;
- this.mCaptchaMimeType = other.mCaptchaMimeType;
- this.mCaptchaAnswer = other.mCaptchaAnswer;
- this.mFlags = other.mFlags;
- this.mStatus = other.mStatus;
- this.mJsonString = other.mJsonString;
- this.mSid = other.mSid;
- this.mAuthtoken = other.mAuthtoken;
- }
-
- //
- // Parcelable interface
- //
-
- /** {@hide} */
- public int describeContents() {
- return 0;
- }
-
- /** {@hide} */
- public void writeToParcel(Parcel out, int flags) {
- out.writeString(mUsername);
- out.writeString(mEncryptedPassword);
- out.writeString(mPassword);
- out.writeString(mService);
- out.writeString(mCaptchaToken);
- if (mCaptchaData == null) {
- out.writeInt(-1);
- } else {
- out.writeInt(mCaptchaData.length);
- out.writeByteArray(mCaptchaData);
- }
- out.writeString(mCaptchaMimeType);
- out.writeString(mCaptchaAnswer);
- out.writeInt(mFlags);
- if (mStatus == null) {
- out.writeString(null);
- } else {
- out.writeString(mStatus.name());
- }
- out.writeString(mJsonString);
- out.writeString(mSid);
- out.writeString(mAuthtoken);
- }
-
- /** {@hide} */
- public static final Parcelable.Creator<LoginData> CREATOR
- = new Parcelable.Creator<LoginData>() {
- public LoginData createFromParcel(Parcel in) {
- return new LoginData(in);
- }
-
- public LoginData[] newArray(int size) {
- return new LoginData[size];
- }
- };
-
- /** {@hide} */
- private LoginData(Parcel in) {
- readFromParcel(in);
- }
-
- /** {@hide} */
- public void readFromParcel(Parcel in) {
- mUsername = in.readString();
- mEncryptedPassword = in.readString();
- mPassword = in.readString();
- mService = in.readString();
- mCaptchaToken = in.readString();
- int len = in.readInt();
- if (len == -1) {
- mCaptchaData = null;
- } else {
- mCaptchaData = new byte[len];
- in.readByteArray(mCaptchaData);
- }
- mCaptchaMimeType = in.readString();
- mCaptchaAnswer = in.readString();
- mFlags = in.readInt();
- String status = in.readString();
- if (status == null) {
- mStatus = null;
- } else {
- mStatus = Status.valueOf(status);
- }
- mJsonString = in.readString();
- mSid = in.readString();
- mAuthtoken = in.readString();
- }
-
- /** Dump contents to a string suitable for debug logging. */
- public String dump() {
- StringBuilder sb = new StringBuilder();
- sb.append(" status: ");
- sb.append(mStatus);
- sb.append("\n username: ");
- sb.append(mUsername);
- sb.append("\n password: ");
- sb.append(mPassword);
- sb.append("\n enc password: ");
- sb.append(mEncryptedPassword);
- sb.append("\n service: ");
- sb.append(mService);
- sb.append("\n authtoken: ");
- sb.append(mAuthtoken);
- sb.append("\n captchatoken: ");
- sb.append(mCaptchaToken);
- sb.append("\n captchaanswer: ");
- sb.append(mCaptchaAnswer);
- sb.append("\n captchadata: ");
- sb.append(
- (mCaptchaData == null ?
- "null" : Integer.toString(mCaptchaData.length) + " bytes"));
- return sb.toString();
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleAppsVerifier.java b/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleAppsVerifier.java
deleted file mode 100644
index 966ef66..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleAppsVerifier.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Copyright (C) 2008 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.google.android.googlelogin;
-
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.Signature;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.text.TextUtils;
-
-/**
- * Helper class that verifies the installed package for Google Apps package is
- * infact Google's Google Apps package.
- * <p>
- * Before attempting to bind to a service, call
- * {@link #isServiceAvailable(Context, String)}. After bound, make sure you are
- * bound to a Google-provided service by calling {@link #isGoogleAppsVerified(Context)}.
- */
-class GoogleAppsVerifier {
-
- /*
- * Magic signature strings. One is from the emulator in the SDK, and the
- * other from a production device.
- */
- private static final String SIGNATURE_1 = "308204a830820390a003020102020900d585b86c7dd34ef5300d06092a864886f70d0101040500308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d301e170d3038303431353233333635365a170d3335303930313233333635365a308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d30820120300d06092a864886f70d01010105000382010d00308201080282010100d6ce2e080abfe2314dd18db3cfd3185cb43d33fa0c74e1bdb6d1db8913f62c5c39df56f846813d65bec0f3ca426b07c5a8ed5a3990c167e76bc999b927894b8f0b22001994a92915e572c56d2a301ba36fc5fc113ad6cb9e7435a16d23ab7dfaeee165e4df1f0a8dbda70a869d516c4e9d051196ca7c0c557f175bc375f948c56aae86089ba44f8aa6a4dd9a7dbf2c0a352282ad06b8cc185eb15579eef86d080b1d6189c0f9af98b1c2ebd107ea45abdb68a3c7838a5e5488c76c53d40b121de7bbd30e620c188ae1aa61dbbc87dd3c645f2f55f3d4c375ec4070a93f7151d83670c16a971abe5ef2d11890e1b8aef3298cf066bf9e6ce144ac9ae86d1c1b0f020103a381fc3081f9301d0603551d0e041604148d1cc5be954c433c61863a15b04cbc03f24fe0b23081c90603551d230481c13081be80148d1cc5be954c433c61863a15b04cbc03f24fe0b2a1819aa48197308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d820900d585b86c7dd34ef5300c0603551d13040530030101ff300d06092a864886f70d0101040500038201010019d30cf105fb78923f4c0d7dd223233d40967acfce00081d5bd7c6e9d6ed206b0e11209506416ca244939913d26b4aa0e0f524cad2bb5c6e4ca1016a15916ea1ec5dc95a5e3a010036f49248d5109bbf2e1e618186673a3be56daf0b77b1c229e3c255e3e84c905d2387efba09cbf13b202b4e5a22c93263484a23d2fc29fa9f1939759733afd8aa160f4296c2d0163e8182859c6643e9c1962fa0c18333335bc090ff9a6b22ded1ad444229a539a94eefadabd065ced24b3e51e5dd7b66787bef12fe97fba484c423fb4ff8cc494c02f0f5051612ff6529393e8e46eac5bb21f277c151aa5f2aa627d1e89da70ab6033569de3b9897bfff7ca9da3e1243f60b";
- private static final String SIGNATURE_2 = "308204433082032ba003020102020900c2e08746644a308d300d06092a864886f70d01010405003074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964301e170d3038303832313233313333345a170d3336303130373233313333345a3074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f696430820120300d06092a864886f70d01010105000382010d00308201080282010100ab562e00d83ba208ae0a966f124e29da11f2ab56d08f58e2cca91303e9b754d372f640a71b1dcb130967624e4656a7776a92193db2e5bfb724a91e77188b0e6a47a43b33d9609b77183145ccdf7b2e586674c9e1565b1f4c6a5955bff251a63dabf9c55c27222252e875e4f8154a645f897168c0b1bfc612eabf785769bb34aa7984dc7e2ea2764cae8307d8c17154d7ee5f64a51a44a602c249054157dc02cd5f5c0e55fbef8519fbe327f0b1511692c5a06f19d18385f5c4dbc2d6b93f68cc2979c70e18ab93866b3bd5db8999552a0e3b4c99df58fb918bedc182ba35e003c1b4b10dd244a8ee24fffd333872ab5221985edab0fc0d0b145b6aa192858e79020103a381d93081d6301d0603551d0e04160414c77d8cc2211756259a7fd382df6be398e4d786a53081a60603551d2304819e30819b8014c77d8cc2211756259a7fd382df6be398e4d786a5a178a4763074310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f69643110300e06035504031307416e64726f6964820900c2e08746644a308d300c0603551d13040530030101ff300d06092a864886f70d010104050003820101006dd252ceef85302c360aaace939bcff2cca904bb5d7a1661f8ae46b2994204d0ff4a68c7ed1a531ec4595a623ce60763b167297a7ae35712c407f208f0cb109429124d7b106219c084ca3eb3f9ad5fb871ef92269a8be28bf16d44c8d9a08e6cb2f005bb3fe2cb96447e868e731076ad45b33f6009ea19c161e62641aa99271dfd5228c5c587875ddb7f452758d661f6cc0cccb7352e424cc4365c523532f7325137593c4ae341f4db41edda0d0b1071a7c440f0fe9ea01cb627ca674369d084bd2fd911ff06cdbf2cfa10dc0f893ae35762919048c7efc64c7144178342f70581c9de573af55b390dd7fdb9418631895d5f759f30112687ff621410c069308a";
-
- private static final String GOOGLEAPPS_PACKAGE_NAME =
- GoogleLoginServiceConstants.SERVICE_PACKAGE_NAME;
-
- /**
- * The possible signatures for the Google Apps package.
- */
- private static final Signature[] GOOGLEAPPS_PACKAGE_SIGNATURES = new Signature[] {
- new Signature(SIGNATURE_1), new Signature(SIGNATURE_2)
- };
-
- /**
- * Checks whether the given service name is available in the Google Apps
- * package.
- * <p>
- * NOTE: This does *not* do any signature checking to ensure the
- * "Google Apps package" is infact from Google. After you bind to the
- * service, call {@link #isGoogleAppsVerified(Context)}.
- *
- * @param context The context.
- * @param serviceName The service name as in the Google Apps manifest.
- * @return Whether it is available on the current system.
- */
- public static boolean isServiceAvailable(Context context, String serviceName) {
-
- try {
- PackageManager packageManager = context.getPackageManager();
- PackageInfo packageInfo = packageManager.getPackageInfo(GOOGLEAPPS_PACKAGE_NAME,
- PackageManager.GET_SERVICES);
-
- if (packageInfo.services == null) {
- return false;
- }
-
- int numServices = packageInfo.services.length;
- for (int i = 0; i < numServices; i++) {
- String name = packageInfo.services[i].name;
- if (!TextUtils.isEmpty(name) && name.equals(serviceName)) {
- return true;
- }
- }
-
- } catch (NameNotFoundException e) {
- // Fallthrough to returning false
- } catch (UnsupportedOperationException e) {
- // A mock implementation of context may throw this, so fallthrough
- // to returning false
- }
-
- return false;
- }
-
- /**
- * Verifies that the installed Google Apps package is infact the one
- * provided by Google (and not someone spoofing us).
- * <p>
- * NOTE: It is important this is called *after* you are bound to the
- * service. Otherwise, it is possible that between the time you call this
- * (returns true) and the time you bind, that the Google Apps package was
- * swapped to a fake one. Rare, but possible.
- *
- * @param context The context.
- * @return Whether the Google Apps package is provided by Google.
- */
- public static boolean isGoogleAppsVerified(Context context) {
-
- try {
- PackageManager packageManager = context.getPackageManager();
- PackageInfo packageInfo = packageManager.getPackageInfo(GOOGLEAPPS_PACKAGE_NAME,
- PackageManager.GET_SIGNATURES);
-
- if (packageInfo.signatures == null) {
- return false;
- }
-
- int numGoogleSignatures = GOOGLEAPPS_PACKAGE_SIGNATURES.length;
- int numSignatures = packageInfo.signatures.length;
- for (int i = 0; i < numSignatures; i++) {
- for (int j = 0; j < numGoogleSignatures; j++) {
- if (GOOGLEAPPS_PACKAGE_SIGNATURES[j].equals(packageInfo.signatures[i])) {
- return true;
- }
- }
- }
-
- } catch (NameNotFoundException e) {
- }
-
- return false;
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceBlockingHelper.java b/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceBlockingHelper.java
deleted file mode 100644
index 98e5eb1..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceBlockingHelper.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/**
- * Copyright (C) 2007 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.google.android.googlelogin;
-
-import com.google.android.googleapps.IGoogleLoginService;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.ServiceConnection;
-import android.os.RemoteException;
-import android.os.IBinder;
-import android.os.Looper;
-
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * A helper designed for use by services and background tasks.
- * This class provides blocking calls that wrap the binding to the
- * {@link IGoogleLoginService GoogleLoginService} and the various
- * calls to it. (Be sure not to call these blocking methods
- * from your main thread, though; you always need to create a separate
- * worker thread for operations that may block.)
- * <p>
- * It's best to instantiate this class once
- * and make calls on that instance when necessary.
- * The helper does not unbind from the GoogleLoginService after
- * each call.
- * <p>
- * When you are done with this object, call close() to unbind from the
- * GoogleLoginService.
- */
-public class GoogleLoginServiceBlockingHelper {
- private static final String TAG = "GoogleLoginServiceBlockingHelper";
-
- private final Context mContext;
- private volatile IGoogleLoginService mGoogleLoginService = null;
- private Lock mGoogleLoginServiceLock = new ReentrantLock();
- private Condition mBindWaitCondition = mGoogleLoginServiceLock.newCondition();
- private ServiceConnection mServiceConnection;
-
- private final int mMinDelaySecs;
- private final int mMaxDelaySecs;
- private final double mBackoffFactor;
- private int mDelay;
-
- /**
- * Whether the Google login service we've bound to is the
- * Google-provided service. This will be set after we get a callback on the
- * service connection, so the value is only valid if
- * {@link #mGoogleLoginService} is not null.
- * <p>
- * Locked with the {@link #mGoogleLoginServiceLock} also.
- */
- private boolean mGlsVerified;
-
- /**
- * Initializes the helper.
- * @param context the Context in which this helper is running
- * @throws GoogleLoginServiceNotFoundException if the Google login service cannot be found.
- */
- public GoogleLoginServiceBlockingHelper(Context context)
- throws GoogleLoginServiceNotFoundException {
- mMinDelaySecs = 5;
- mMaxDelaySecs = 5 * 60; // 5 minutes
- mBackoffFactor = 2.0;
- mDelay = mMinDelaySecs;
- mContext = context;
-
- // Ensure the Google Login Service is available
- if (!GoogleAppsVerifier.isServiceAvailable(context,
- GoogleLoginServiceConstants.FULLY_QUALIFIED_SERVICE_NAME)) {
- throw new GoogleLoginServiceNotFoundException(
- GoogleLoginServiceConstants.ERROR_CODE_GLS_NOT_FOUND);
- }
-
- mGoogleLoginServiceLock.lock();
- try {
- mServiceConnection = new ServiceConnection() {
- public void onServiceConnected(ComponentName className, IBinder service) {
- try {
- mGoogleLoginServiceLock.lock();
-
- /*
- * Verify that the service we just connected to is
- * provided by Google. Eventually, this will manifest
- * into an exception, but we can't throw it here because
- * our client isn't in the call stack right now.
- */
- mGlsVerified = GoogleAppsVerifier.isGoogleAppsVerified(mContext);
-
- mGoogleLoginService = IGoogleLoginService.Stub.asInterface(service);
-
- mBindWaitCondition.signalAll();
- } finally {
- mGoogleLoginServiceLock.unlock();
- }
- }
-
- public void onServiceDisconnected(ComponentName className) {
- mGoogleLoginServiceLock.lock();
- mGoogleLoginService = null;
- mGoogleLoginServiceLock.unlock();
- }
- };
-
- if (!mContext.bindService(GoogleLoginServiceConstants.SERVICE_INTENT,
- mServiceConnection, Context.BIND_AUTO_CREATE)) {
- throw new GoogleLoginServiceNotFoundException(
- GoogleLoginServiceConstants.ERROR_CODE_GLS_NOT_FOUND);
- }
- } finally {
- mGoogleLoginServiceLock.unlock();
- }
- }
-
- /**
- * Releases the binding to the GoogleLoginService (if one exists). This object
- * is no longer usable one this method is invoked.
- */
- public void close() {
- mGoogleLoginServiceLock.lock();
- try {
- if (mServiceConnection != null) {
- mContext.unbindService(mServiceConnection);
- mServiceConnection = null;
- mGoogleLoginService = null;
- }
- } finally {
- mGoogleLoginServiceLock.unlock();
- }
- }
-
- /**
- * Sleep for an exponentially-increasing length of time (bounded
- * by mMinDelaySecs and mMaxDelaySecs).
- */
- private void delay() {
- try {
- Thread.sleep(mDelay * 1000L);
- } catch (InterruptedException ignore) {
- // just delay for less time
- }
- mDelay *= mBackoffFactor;
- if (mDelay > mMaxDelaySecs) mDelay = mMaxDelaySecs;
- }
-
- /**
- * Reset the sleep time used by delay() to the minimum.
- */
- private void resetDelay() {
- mDelay = mMinDelaySecs;
- }
-
- /**
- * Waits for mGoogleLoginService to be nun-null and then returns it. It is set in the
- * onServiceConnected that is called as a result of the bind that is called by the
- * constructor.
- * @return the GoogleLoginService, guaranteed to be non-null
- * @throws GoogleLoginServiceNotFoundException if the Google login service cannot be found.
- */
- private IGoogleLoginService getLoginService() throws GoogleLoginServiceNotFoundException {
- if (Looper.myLooper() == mContext.getMainLooper()) {
- throw new IllegalStateException("calling GoogleLoginServiceBlockingHelper methods "
- + "from your main thread can lead to deadlock");
- }
- try {
- mGoogleLoginServiceLock.lock();
- while (mGoogleLoginService == null) {
- try {
- mBindWaitCondition.await();
- } catch (InterruptedException e) {
- // keep waiting
- }
- }
-
- checkGoogleLoginServiceVerificationLocked();
-
- return mGoogleLoginService;
- } finally {
- mGoogleLoginServiceLock.unlock();
- }
- }
-
- private void checkGoogleLoginServiceVerificationLocked()
- throws GoogleLoginServiceNotFoundException {
- if (mGoogleLoginService != null && !mGlsVerified) {
- throw new GoogleLoginServiceNotFoundException(
- GoogleLoginServiceConstants.ERROR_CODE_GLS_VERIFICATION_FAILED);
- }
- }
-
- /**
- * Gets the login service via getLoginService, which may block, and then
- * invokes getAndroidId on it.
- *
- * @see IGoogleLoginService#getAndroidId()
- * @return the Android ID for this device (a 64-bit value unique to this
- * device); 0 if the device is not registered with google or if the Android
- * ID is otherwise unavailable.
- * @throws GoogleLoginServiceNotFoundException if the Google login service cannot be found.
- */
- public static long getAndroidId(Context context) throws GoogleLoginServiceNotFoundException {
- GoogleLoginServiceBlockingHelper h = new GoogleLoginServiceBlockingHelper(context);
- try {
- return h.getAndroidId();
- } finally {
- h.close();
- }
- }
-
- /**
- * Gets the login service via getLoginService, which may block, and then
- * invokes getAndroidId on it.
- *
- * @see IGoogleLoginService#getAndroidId()
- * @return the Android ID for this device (a 64-bit value unique to this
- * device); 0 if the device is not registered with google or if the Android
- * ID is otherwise unavailable.
- * @throws GoogleLoginServiceNotFoundException if the Google login service cannot be found.
- */
- public long getAndroidId() throws GoogleLoginServiceNotFoundException {
- resetDelay();
- while (true) {
- IGoogleLoginService loginService = getLoginService();
- try {
- return loginService.getAndroidId();
- } catch (RemoteException e) {
- // the next call to getLoginService will wait until the service
- // is reconnected
- delay();
- }
- }
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceConstants.java b/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceConstants.java
deleted file mode 100644
index 63293b3..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceConstants.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Copyright (C) 2007 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.google.android.googlelogin;
-
-import android.content.Intent;
-// import android.accounts.AccountManager;
-
-/**
- * Miscellaneous constants used by the GoogleLoginService and its
- * clients.
- */
-public class GoogleLoginServiceConstants {
- /** This class is never instantiated. */
- private GoogleLoginServiceConstants() {
- }
-
- /**
- * Key used in the "extras" bundle.
- * <p>
- * The value of the mapping with this key is a String[]
- * representing the Google accounts currently known on the device.
- */
- public static final String ACCOUNTS_KEY = "accounts"; // AccountManager.KEY_ACCOUNTS;
-
- /**
- * Key used in the "extras" bundle.
- * <p>
- * The value of the mapping with this key is a String containing
- * the requested authentication token.
- */
- public static final String AUTHTOKEN_KEY = "authtoken"; // AccountManager.KEY_AUTHTOKEN;
-
- /**
- * Key used in the "extras" bundle.
- * <p>
- * The value of the mapping with this key is a String containing
- * the account name (username) used to generate the accompanying
- * authentication token.
- */
- public static final String AUTH_ACCOUNT_KEY = "authAccount"; // AccountManager.KEY_ACCOUNT_NAME;
-
- /**
- * Key used in the "extras" bundle that will be present if an error
- * has occurred.
- * <p>
- * The value of the mapping with this key is an int. The possible values are
- * {@link #ERROR_CODE_GLS_NOT_FOUND} or
- * {@link #ERROR_CODE_GLS_VERIFICATION_FAILED}.
- */
- public static final String ERROR_CODE_KEY = "errorCode"; // AccountManager.KEY_ERROR_CODE;
-
- /**
- * Error code (see {@link #ERROR_CODE_KEY}) for when the Google login
- * service can not be found.
- */
- public static final int ERROR_CODE_GLS_NOT_FOUND = 0;
-
- /**
- * Error code (see {@link #ERROR_CODE_KEY}) for when the verification of the
- * Google login service fails.
- */
- public static final int ERROR_CODE_GLS_VERIFICATION_FAILED = 1;
-
- /**
- * Gets a message (can be used as an Exception message) for a particular
- * error code.
- *
- * @param errorCode The error code.
- * @return A message describing the error code. This will not be localized.
- */
- static String getErrorCodeMessage(int errorCode) {
- switch (errorCode) {
- case ERROR_CODE_GLS_NOT_FOUND:
- return "The Google login service cannot be found.";
-
- case ERROR_CODE_GLS_VERIFICATION_FAILED:
- return "The Google login service cannot be verified.";
-
- default:
- return "Unknown error";
- }
- }
-
- /**
- * Extras to be returned to the caller.
- */
- public static final String REQUEST_EXTRAS = "callerExtras";
-
- /**
- * YouTube logins produce an extra bit of data: the youtube
- * username linked to the google account that we log in to.
- * getAuthToken will return this extra string when logging
- * in to the 'youtube' service.
- */
- public static final String YOUTUBE_USER_KEY = "YouTubeUser";
-
- /**
- * The name of the Google login service.
- */
- public static final String SERVICE_NAME = "GoogleLoginService";
-
- /**
- * The package name of the Google login service.
- */
- public static final String SERVICE_PACKAGE_NAME = "com.google.android.googleapps";
-
- /**
- * The fully qualified name of the Google login service (package + name).
- */
- public static final String FULLY_QUALIFIED_SERVICE_NAME =
- SERVICE_PACKAGE_NAME + "." + SERVICE_NAME;
-
- /** The intent used to bind to the Google Login Service. */
- public static final Intent SERVICE_INTENT =
- (new Intent()).setClassName(SERVICE_PACKAGE_NAME, FULLY_QUALIFIED_SERVICE_NAME);
-
- public static final int FLAG_GOOGLE_ACCOUNT = 0x1;
- public static final int FLAG_HOSTED_ACCOUNT = 0x2;
- public static final int FLAG_YOUTUBE_ACCOUNT = 0x4;
- public static final int FLAG_SAML_ACCOUNT = 0x8;
- public static final int FLAG_LEGACY_GOOGLE = 0x10;
- public static final int FLAG_LEGACY_HOSTED_OR_GOOGLE = 0x20;
-
- public static final String FEATURE_LEGACY_GOOGLE = "legacy_google";
- public static final String FEATURE_LEGACY_HOSTED_OR_GOOGLE = "legacy_hosted_or_google";
- public static final String FEATURE_HOSTED_OR_GOOGLE = "hosted_or_google";
- public static final String FEATURE_GOOGLE = "google";
- public static final String FEATURE_YOUTUBE = "youtubelinked";
- public static final String FEATURE_SAML_ACCOUNT = "saml";
-
- /**
- * Prefix for service features, combine with the service name (as defined by
- * ClientLogin ) for example service_cp for an account having calendar.
- */
- public static final String FEATURE_SERVICE_PREFIX = "service_";
-
- public static final boolean REQUIRE_GOOGLE = true;
- public static final boolean PREFER_HOSTED = false;
-
- // the account type for google accounts that are authenticated via GAIA
- public static final String ACCOUNT_TYPE = "com.google";
-
- /**
- * Action sent as a broadcast Intent by the AccountsService
- * when it starts up and no accounts are available (so some should be added).
- */
- public static final String LOGIN_ACCOUNTS_MISSING_ACTION =
- "com.google.android.googlelogin.LOGIN_ACCOUNTS_MISSING";
-
- public static String featureForService(String service) {
- return FEATURE_SERVICE_PREFIX + service;
- }
-}
diff --git a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceNotFoundException.java b/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceNotFoundException.java
deleted file mode 100644
index 5fa3c1b..0000000
--- a/AndroidVendorSecurityTool/src/com/google/android/googlelogin/GoogleLoginServiceNotFoundException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (C) 2007 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.google.android.googlelogin;
-
-import android.util.AndroidException;
-
-/**
- * This exception is thrown when the Google login service is not found on the
- * device.
- */
-public class GoogleLoginServiceNotFoundException extends AndroidException {
-
- private int mErrorCode;
-
- public GoogleLoginServiceNotFoundException(int errorCode) {
- super(GoogleLoginServiceConstants.getErrorCodeMessage(errorCode));
-
- mErrorCode = errorCode;
- }
-
- /**
- * Returns the error code for this exception.
- *
- * @return The error code for this exception.
- */
- int getErrorCode() {
- return mErrorCode;
- }
-}
diff --git a/droiddreamclean/Android.mk b/droiddreamclean/Android.mk
deleted file mode 100644
index c82eb93..0000000
--- a/droiddreamclean/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES:= droiddreamclean.c
-
-LOCAL_MODULE:= droiddreamclean
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-
-LOCAL_STATIC_LIBRARIES := libc
-
-include $(BUILD_EXECUTABLE)
diff --git a/droiddreamclean/droiddreamclean.c b/droiddreamclean/droiddreamclean.c
deleted file mode 100644
index de849f2..0000000
--- a/droiddreamclean/droiddreamclean.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mount.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <ctype.h>
-
-/* from mwomack's product_data.csv */
-const char *packages[] = { "Super.mobi.eraser",
- "advanced.piano",
- "com.Funny.Face",
- "com.advanced.SoundManager",
- "com.advanced.scientific.calculator",
- "com.app.aun",
- "com.apps.tosd",
- "com.beauty.leg",
- "com.bubble",
- "com.dice.power",
- "com.dice.power.advanced",
- "com.dodge.game.fallingball",
- "com.droiddream.advancedtaskkiller1",
- "com.droiddream.android.afdvancedfm",
- "com.droiddream.barcodescanner",
- "com.droiddream.basketball",
- "com.droiddream.blueftp",
- "com.droiddream.bowlingtime",
- "com.droiddream.comparator",
- "com.droiddream.compasslevel",
- "com.droiddream.daltonismo",
- "com.droiddream.fallingball",
- "com.droiddream.game.omok",
- "com.droiddream.glowhockey",
- "com.droiddream.howtotie",
- "com.droiddream.lovePositions",
- "com.droiddream.musicbox",
- "com.droiddream.passwordsafe",
- "com.droiddream.pewpew",
- "com.droiddream.sexringtones",
- "com.droiddream.stopwatch",
- "com.droiddream.system.app.remover",
- "com.editor.photoenhance",
- "com.fall.down",
- "com.fall.soft.down",
- "com.free.chess",
- "com.free.game.finger",
- "com.hg.panzerpanic1",
- "com.hz.game.mrrunner1",
- "com.magic.spiral",
- "com.power.SuperSolo",
- "com.power.basketball",
- "com.power.demo.note",
- "com.power.magic.StrobeLight",
- "com.quick.Delete",
- "com.sex.japaneese.girls",
- "com.sexsound.hilton",
- "com.sexy.hotgirls",
- "com.sexy.legs",
- "com.spider.man",
- "com.super.mp3ringtone",
- "hot.goddchen.sexyvideos",
- "org.droiddream.yellow4",
- "power.nick.ypaint",
- "power.power.rate",
- "powerstudio.spiderman",
- "proscio.app.nick.ypaint",
- "super.sancron.ringtones.sexysb",
- "org.super.yellow4",
- "com.droid.publick.hotgirls",
- "com.super.free.sexringtones",
- "hot.goddchen.power.sexyvideos",
- "\0"};
-
-#define MAX_PACKAGES 512
-#define MAX_PACKAGE_NAME_LENGTH 512
-
-char installed_packages[MAX_PACKAGES][MAX_PACKAGE_NAME_LENGTH];
-int num_packages;
-
-void llog(char * msg, int result) {
- printf("%s:%s", msg, (result==0)?"Success":"Failure"); // Success is 0.
- if (result != 0 && errno != 0) {
- printf(" errorno=%s", strerror(errno));
- }
- printf("\n");
-}
-
-char *strstrip(char *s) {
- size_t size;
- char *end;
-
- size = strlen(s);
-
- if (!size)
- return s;
-
- end = s + size - 1;
- while (end >= s && isspace(*end))
- end--;
- *(end + 1) = '\0';
-
- while (*s && isspace(*s))
- s++;
-
- return s;
-}
-
-void populate_installed_packages() {
- FILE *fp;
- char pkg[MAX_PACKAGE_NAME_LENGTH];
- int len;
- num_packages = 0;
-
- fp = popen("/system/bin/pm list packages", "r");
-
- if (fp == NULL) {
- printf("failed to run /system/bin/pm list packages. not removing apps.\n");
- return;
- }
-
- while ((fgets(pkg, sizeof(pkg)-1,fp) != NULL)
- && num_packages < MAX_PACKAGES) {
-
- //printf("package before = %s\n", pkg);
- len = (strlen(pkg)-8 < MAX_PACKAGE_NAME_LENGTH)?(strlen(pkg)-8):MAX_PACKAGE_NAME_LENGTH;
- strncpy(installed_packages[num_packages], (pkg+8), len);
- // pkg+8 removes the initial "package:""
- strstrip(installed_packages[num_packages]);
- //printf("package after = %s\n", installed_packages[num_packages]);
- num_packages++;
- }
-
- pclose(fp);
-}
-
-int package_installed(const char *package_name) {
-
- int i;
-
- for (i=0; i<num_packages; i++) {
- if (strcmp(package_name, installed_packages[i]) == 0) {
- return i;
- }
- }
-
- return -1;
-}
-
-void remove_package(const char *package_name, int idx) {
- char command[1024];
- int retval;
-
- printf("%d:",idx);
- fflush(stdout);
-
- snprintf(command, 1024, "pm uninstall %s", package_name);
- retval = system(command);
-}
-
-
-void getSystemMountPoint(char * dev) {
- FILE *f = fopen("/proc/mounts", "r");
- if (f == NULL) {
- printf("unable to read /proc/mounts: \n");
- exit(1);
- }
-
- char mountPoint[1024];
- char type[1024];
- char opts[1024];
- int freq;
- int passno;
-
- while(1) {
- int retval = fscanf(f, "%s %s %s %s %d %d", dev,
- mountPoint, type, opts, &freq, &passno);
- if (retval != 6) {
- llog("getsysmntpnt wrong num args", retval);
- exit(1);
- }
- if (strcmp(mountPoint, "/system")) {
- return;
- }
- }
-}
-
-int file_exists(const char *filename) {
- FILE *f;
-
- if (f = fopen(filename, "r")) {
- fclose(f);
- return 1;
- }
- return 0;
-}
-
-int main() {
- int retval;
- char dev[1024];
- int i=0;
-
- printf("elh\n");
-
- if (getuid() != 0) {
- printf("not running as root\n");
- exit(1);
- }
-
- populate_installed_packages();
-
- while (packages[i][0] != '\0') {
- if (package_installed(packages[i]) != -1) {
- remove_package(packages[i], i);
- }
- i++;
- }
-
- getSystemMountPoint(dev);
-
- errno = 0;
- retval = mount(dev, "/system", "ignored", MS_REMOUNT, NULL);
- llog("mnt rw", retval);
-
- if (retval != 0) {
- // no use continuing if we can't remount read-write
- exit(1);
- }
-
- if (file_exists("/system/app/DownloadProvidersManager.apk")) {
- errno = 0;
- retval = unlink("/system/app/DownloadProvidersManager.apk");
- llog("rm DownloadProvidersManager", retval);
-
- errno = 0;
- printf("pm uninst downloadsmanager:");
- fflush(stdout);
- system("/system/bin/pm uninstall com.android.providers.downloadsmanager");
- }
-
- if (file_exists("/system/app/com.android.providers.ammanage.apk")) {
- errno = 0;
- retval = unlink("/system/app/com.android.providers.ammanage.apk");
- llog("rm ammanager", retval);
-
- errno = 0;
- printf("pm uninst ammanager:");
- fflush(stdout);
- system("/system/bin/pm uninstall com.android.providers.ammanage");
- }
-
- if (file_exists("/system/bin/profile")) {
- errno = 0;
- retval = unlink("/system/bin/profile");
- llog("rm profile", retval);
- }
-
- if (file_exists("/system/bin/share")) {
- errno = 0;
- retval = unlink("/system/bin/share");
- llog("rm share", retval);
- }
-
- /*
- * technically it's ok if the next line fails, as the
- * filesystem will be mounted read-only on the next boot
- */
- errno = 0;
- retval = mount(dev, "/system", "ignored", MS_REMOUNT | MS_RDONLY, NULL);
- llog("mnt ro", retval);
-
- return 0;
-}