Moving signal strength sampling into a separate app.

This commit is contained in:
Rodrigo Damazio
2010-11-26 23:51:32 -08:00
parent 7abce12499
commit 5971d67a66
49 changed files with 1341 additions and 315 deletions
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" kind="src" path="/SignalStrengthSampler"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="lib" path="libs/AndroidMockRuntime.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
+34
View File
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>SignalStrengthSamplerTest</name>
<comment></comment>
<projects>
<project>SignalStrengthSampler</project>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,5 @@
#Fri Nov 26 22:23:21 PST 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.source=1.5
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.android.apps.mytracks.signalstrength.test"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name">
<uses-library android:name="android.test.runner" />
</application>
<uses-sdk android:minSdkVersion="3" />
<instrumentation android:targetPackage="com.google.android.apps.mytracks.signalstrength"
android:name="android.test.InstrumentationTestRunner" />
</manifest>
@@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=Google Inc.:Google APIs:8
+34
View File
@@ -0,0 +1,34 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2010 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.
-->
<resources>
<string name="hello">Hello World!</string>
</resources>
@@ -0,0 +1,68 @@
/*
* Copyright 2010 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.google.android.apps.mytracks.signalstrength.test;
import com.google.android.apps.mytracks.signalstrength.SignalStrengthListener;
import com.google.android.apps.mytracks.signalstrength.SignalStrengthListener.SignalStrengthCallback;
import com.google.android.apps.mytracks.signalstrength.SignalStrengthListenerCupcake;
import com.google.android.apps.mytracks.signalstrength.SignalStrengthListenerEclair;
import com.google.android.apps.mytracks.signalstrength.SignalStrengthListenerFactory;
import com.google.android.testing.mocking.AndroidMock;
import android.test.AndroidTestCase;
/**
* Tests for {@link SignalStrengthListenerFactory}.
* These tests require Eclair+ (API level 7) to run.
*
* @author Rodrigo Damazio
*/
public class SignalStrengthListenerFactoryTest extends AndroidTestCase {
private boolean hasModernSignalStrength;
private TestableSignalStrengthListenerFactory factory;
private SignalStrengthCallback callback;
private class TestableSignalStrengthListenerFactory extends SignalStrengthListenerFactory {
@Override
protected boolean hasModernSignalStrength() {
return hasModernSignalStrength;
}
}
@Override
protected void setUp() throws Exception {
super.setUp();
factory = new TestableSignalStrengthListenerFactory();
callback = AndroidMock.createMock(SignalStrengthCallback.class);
}
public void testCreate_eclair() {
hasModernSignalStrength = true;
SignalStrengthListener listener = factory.create(getContext(), callback);
assertTrue(listener.getClass().getName(),
listener instanceof SignalStrengthListenerEclair);
}
public void testCreate_legacy() {
hasModernSignalStrength = false;
SignalStrengthListener listener = factory.create(getContext(), callback);
assertTrue(listener.getClass().getName(),
listener instanceof SignalStrengthListenerCupcake);
}
}