Merge remote-tracking branch 'origin/master' into bug4469

This commit is contained in:
Robin Kuck committed 2019-02-04 22:33:01 +01:00
commit 86ebdc7042
1228 files changed
+641 -164306

No files matched your search

+2 -2
View File
@@ -13,7 +13,7 @@ buildscript {
}
}
dependencies {
classpath "com.android.tools.build:gradle:3.2.1"
classpath 'com.android.tools.build:gradle:3.3.0'
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.3"
classpath "org.ajoberstar:grgit:2.3.0"
}
@@ -34,7 +34,7 @@ allprojects {
version = "1.0.0-SNAPSHOT"
tasks.withType(JavaCompile) {
tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.encoding = 'UTF-8'
+80 -90
View File
@@ -1,82 +1,87 @@
#!/bin/sh
ANDROID_RELEASE_BRANCH=android-xmake-release
RELEASE_BRANCH=rel-1.4
APP_MANIFESTS="mobile/com.sap.sailing.android.tracking.app/AndroidManifest.xml mobile/com.sap.sailing.buoy.positioning/AndroidManifest.xml mobile/com.sap.sailing.racecommittee.app/AndroidManifest.xml"
APP_DIRS="mobile/com.sap.sailing.android.tracking.app/ mobile/com.sap.sailing.android.buoy.positioning.app/ mobile/com.sap.sailing.racecommittee.app/"
APP_GRADLE_PROPERTIES="gradle.properties"
FILES2SIGN=cfg/files2sign.json
VERSION_FILE=cfg/VERSION
GIT_REMOTE=origin
# proxy can be requested with -x
PROXY_SETTINGS=
UPDATE_ANDROID_MANIFEST_VERSIONS=1
UPDATE_POM_VERSIONS=1
PERFORM_GIT_OPERATIONS=1
OPTION_PROXY_SETTINGS=
OPTION_UPDATE_ANDROID_VERSIONS=1
OPTION_PERFORM_GIT_OPERATIONS=1
usage() {
echo "$0 [-m -g -r <git-remote>]"
echo ""
echo "See more usage details in the sapsailing.com wiki at:"
echo " https://wiki.sapsailing.com/wiki/info/landscape/building-and-deploying#building-deploying-stopping-and-starting-server-instances"
echo "-m Disable upgrading the versionCode and versionName"
echo "-g Disable the final git push operation to $RELEASE_BRANCH"
echo "-r The git remote; defaults to origin"
exit 2
}
# Read and update versionCode in build.gradle
# Based on new versionCode the versionNme will also be updated.
increment_version_code_and_set_version_name() {
MANIFEST=$1
NEW_VERSION_NAME=$2
echo "Incrementing version code and version name for $MANIFEST"
OLD_VERSION_CODE=`grep 'android:versionCode="[0-9]*"' $MANIFEST | sed -e 's/^.*android:versionCode="\([0-9]*\)".*$/\1/'`
DIR=$1
GRADLE_PROPERTIES_FILE=$DIR$APP_GRADLE_PROPERTIES
echo "Incrementing version code and version name for $DIR"
OLD_VERSION_CODE=`grep 'appVersionCode=[0-9]*' $GRADLE_PROPERTIES_FILE | sed -e 's/^.*appVersionCode=\([0-9]*\).*$/\1/'`
NEW_VERSION_CODE=$(($OLD_VERSION_CODE + 1))
echo $MANIFEST: OLD_VERSION_CODE is $OLD_VERSION_CODE, NEW_VERSION_CODE is $NEW_VERSION_CODE
echo $MANIFEST: Using versionName=\"$NEW_VERSION_NAME\"
sed --in-place -e "s/android:versionCode=\"$OLD_VERSION_CODE\"/android:versionCode=\"$NEW_VERSION_CODE\"/" -e "s/android:versionName=\"\([^\"]*\)\"/android:versionName=\"$NEW_VERSION_NAME\"/" "$MANIFEST"
NEW_VERSION_NAME=1.4.$NEW_VERSION_CODE
echo $DIR: OLD_VERSION_CODE is $OLD_VERSION_CODE, NEW_VERSION_CODE is $NEW_VERSION_CODE
echo $DIR: Using NEW_VERSION_NAME=\"$NEW_VERSION_NAME\"
sed --in-place -e "s/appVersionCode=$OLD_VERSION_CODE/appVersionCode=$NEW_VERSION_CODE/" "$GRADLE_PROPERTIES_FILE"
sed --in-place -e "s/appVersionName=\([^\"]*\)/appVersionName=$NEW_VERSION_NAME/" "$GRADLE_PROPERTIES_FILE"
}
upgrade_pom_and_manifest_versions() {
POM=$1
NEW_POM_VERSION=$2
POM_WITH_PARENT_SPEC_REMOVED="${POM}.parentspecremoved"
PARENT_SPEC="${POM}.parentspec"
RESTORED_POM_WITH_NEW_VERSION_AND_PARENT_SPEC="${POM}.restored"
POM_BACKUP="${POM}.bak"
cp "$POM" "$POM_BACKUP"
# find the area to remove
snip_area_start_line=`grep -n SNIP_MARKER_START pom.xml | sed -e 's/^\([0-9]*\):.*$/\1/'`
snip_area_end_line=`grep -n SNIP_MARKER_END pom.xml | sed -e 's/^\([0-9]*\):.*$/\1/'`
sed -e "$snip_area_start_line,$snip_area_end_line d" <"$POM" >"$POM_WITH_PARENT_SPEC_REMOVED"
sed -e "1,$((snip_area_start_line - 1)) d" -e "$((snip_area_end_line + 1)),$ d" <"$POM" >"$PARENT_SPEC"
cp "$POM_WITH_PARENT_SPEC_REMOVED" "$POM"
echo mvn $PROXY_SETTINGS -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$NEW_POM_VERSION
mvn $PROXY_SETTINGS -Dldi.releaseBuild=true -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=$NEW_POM_VERSION
sed --in-place -e 's/$/\\/' "$PARENT_SPEC"
cat "$POM" | sed -e "$snip_area_start_line i \\`cat "$PARENT_SPEC"`" | sed -e "$snip_area_start_line,$snip_area_end_line s/\\\\$//" >"$RESTORED_POM_WITH_NEW_VERSION_AND_PARENT_SPEC"
cp "$RESTORED_POM_WITH_NEW_VERSION_AND_PARENT_SPEC" "$POM"
# Update files2sign.json with new updated version name
# replace, e.g. "version": "1.4.xy" with new one
update_files2sign() {
echo "Update files2sign.json with new versionName $NEW_VERSION_NAME"
OLD_VERSION_NAMES=`grep '"version": "1.4.[0-9]*"' $FILES2SIGN | sed -e 's/^.*\"version\": \"\(1.4.[0-9]*\)\".*$/\1/'`
for OLD_VERSION_NAME in $OLD_VERSION_NAMES; do
sed --in-place -e "s/\"version\": \"$OLD_VERSION_NAME\"/\"version\": \"$NEW_VERSION_NAME\"/" "$FILES2SIGN"
done
}
if [ $# -eq 0 ]; then
echo "$0 [-m -p -g -r <git-remote>] CR-Id: <TheJCWBCRId>"
echo ""
echo "Request a new Java Correction Workbench (JCWB) Correction Request ID at:"
echo " https://css.wdf.sap.corp/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/jcwb/default.htm?newCMForProject=sapsailingcapture#"
echo "See more usage details in the sapsailing.com wiki at:"
echo " https://wiki.sapsailing.com/wiki/info/landscape/building-and-deploying#building-deploying-stopping-and-starting-server-instances"
echo "-m Disable upgrading the AndroidManifest.xml versionCode and versionName"
echo "-p Disable upgrading the pom.xml and MANIFEST.MF versions"
echo "-g Disable the final git push operation to $RELEASE_BRANCH"
echo "-r The git remote; defaults to origin"
echo ""
echo "Example: $0 CR-Id: 012003146900000486712016"
exit 2
fi
# Update the cfg/VERSION file with new updated version name
update_version_file() {
echo "Update cfg/VERSION with new versionName $NEW_VERSION_NAME"
echo $NEW_VERSION_NAME > "$VERSION_FILE"
}
options='mpgrx:'
while getopts $options option
# Parse the first argument for the help option
while [ "$1" != "" ]
do
case $option in
m) UPDATE_ANDROID_MANIFEST_VERSIONS=0;;
p) UPDATE_POM_VERSIONS=0;;
g) PERFORM_GIT_OPERATIONS=0;;
r) GIT_REMOTE=$OPTARG;;
x) PROXY_SETTINGS="-s configuration/maven-settings-proxy.xml -Dhttp.proxyHost=proxy.wdf.sap.corp -Dhttp.proxyPort=8080";;
\?) echo "Invalid option"
exit 4;;
esac
case $1 in
-h | --help) usage;;
*) break;;
esac
done
shift $((OPTIND-1))
# Parse the options
options="mgxr:"
while getopts "$options" option
do
case $option in
m) OPTION_UPDATE_ANDROID_VERSIONS=0;;
g) OPTION_PERFORM_GIT_OPERATIONS=0;;
g) OPTION_PERFORM_GIT_OPERATIONS=0;;
r) GIT_REMOTE=$OPTARG;;
\?) exit 4;;
esac
done
shift $((OPTIND - 1))
# change directory to the git root, assuming this script is in the configuration/ subfolder
GIT_DIR="`dirname \"$0\"`/.."
echo GIT_DIR: $GIT_DIR
JCWB_CHANGE_REQUEST_ID_GIT_TAG=$*
echo "Releasing based on Java Correction Workbench (JCWB) Correction Request ID tag $JCWB_CHANGE_REQUEST_ID_GIT_TAG"
cd "$GIT_DIR"
git fetch $GIT_REMOTE
@@ -84,49 +89,34 @@ git checkout $ANDROID_RELEASE_BRANCH
git merge -m "Merging $GIT_REMOTE/$ANDROID_RELEASE_BRANCH" $GIT_REMOTE/$ANDROID_RELEASE_BRANCH
git fetch $GIT_REMOTE $RELEASE_BRANCH:$RELEASE_BRANCH
git merge -m "Merging $RELEASE_BRANCH into $ANDROID_RELEASE_BRANCH, probably incorporating version setting to -SNAPSHOT" $GIT_REMOTE/$RELEASE_BRANCH
if [ "$PERFORM_GIT_OPERATIONS" = "1" ]; then
if [ "$OPTION_PERFORM_GIT_OPERATIONS" = "1" ]; then
git push $GIT_REMOTE $ANDROID_RELEASE_BRANCH:$ANDROID_RELEASE_BRANCH
fi
# Determine the version in the root pom.xml; if a -SNAPSHOT version, simply remove the -SNAPSHOT;
# otherwise, increment micro version by one and use the Tycho version plugin to update;
# For this to work, the <parent> specification needs to be removed from the top-level pom which later
# needs to be re-activated before committing everything
OLD_POM_VERSION=`head -n 15 pom.xml | grep '<version>.*</version>' | sed -e 's/^.*<version>\(.*\)<\/version>.*$/\1/'`
echo $OLD_POM_VERSION | grep -q -- "-SNAPSHOT"
if [ "$?" = "0" ]; then
# found a -SNAPSHOT identifier; assuming this was for the next release already; simply remove -SNAPSHOT
NEW_POM_VERSION=`echo $OLD_POM_VERSION | sed -e 's/-SNAPSHOT//'`
else
# no -SNAPSHOT found; increment the micro version by one
NEW_POM_VERSION=`echo $OLD_POM_VERSION | (IFS=. read major minor micro; echo ${major}.${minor}.$(($micro + 1)) )`
fi
echo OLD_POM_VERSION is $OLD_POM_VERSION, NEW_POM_VERSION is $NEW_POM_VERSION
if [ "$UPDATE_POM_VERSIONS" = "1" ]; then
upgrade_pom_and_manifest_versions pom.xml $NEW_POM_VERSION
fi
# Patch the AndroidManifest.xml files to upgrade the android:versionCode sequential counter relevant for the PlayStore
# and the android:versionName which is what the user sees and which we expect to follow a major.minor version scheme,
# Patch the build.gradle files to upgrade the versionCode sequential counter relevant for the PlayStore
# and the versionName which is what the user sees and which we expect to follow a major.minor version scheme,
# where this script increments the minor version by one
if [ "$UPDATE_ANDROID_MANIFEST_VERSIONS" = "1" ]; then
for m in $APP_MANIFESTS; do
increment_version_code_and_set_version_name $m $NEW_POM_VERSION
if [ "$OPTION_UPDATE_ANDROID_VERSIONS" = "1" ]; then
for m in $APP_DIRS; do
increment_version_code_and_set_version_name $m
done
update_files2sign
update_version_file
fi
# Now commit the version changes and amend the commit using the change request ID tag:
git commit -a -m "Upgraded Android apps from version $OLD_POM_VERSION to $NEW_POM_VERSION"
git commit --amend -m "`git show -s --pretty=format:%s%n%n%b`
$JCWB_CHANGE_REQUEST_ID_GIT_TAG"
if [ "$PERFORM_GIT_OPERATIONS" = "1" ]; then
git commit -a -m "Upgraded Android apps from version $OLD_VERSION_NAME to $NEW_VERSION_NAME"
git commit --amend -m "`git show -s --pretty=format:%s%n%n%b`"
if [ "$OPTION_PERFORM_GIT_OPERATIONS" = "1" ]; then
git push $GIT_REMOTE $ANDROID_RELEASE_BRANCH:$RELEASE_BRANCH
fi
echo "Now go to https://git.wdf.sap.corp/#/dashboard/self and vote on your change, using the \"Reply\" button."
echo "Remove the pMiosVoter because it has nothing good to say on Android. Then \"Submit\" your change to merge it to $RELEASE_BRANCH."
echo "After successful merge, launch a customer stage build here: https://xmake-ldi.wdf.sap.corp:8443/view/SAPSail/job/sapsailingcapture-Release/"
echo "When done, create a BCP update ticket. See https://wiki.wdf.sap.corp/wiki/display/NAAS/Mobile+Patch+Releases (remove the saprole parameter from the URL)"
echo "When done, create a BCP update ticket. See https://wiki.wdf.sap.corp/wiki/display/NAAS/Mobile+Patch+Releases \(remove the saprole parameter from the URL\)"
echo "Copy the description of, e.g., https://support.wdf.sap.corp/sap/support/message/1670304244 to start with and adjust versions and commit IDs."
echo "Make sure you have your Metaman stuff updated, particularly the Release Notes section."
echo "Then wait for feedback on the release build being ready for smoke testing, do the smoke tests and report back in BCP. That's it :-)"
echo "Then wait for feedback on the release build being ready for smoke testing, do the smoke tests and report back in BCP. That\'s it :-\)"
+1 -1
View File
@@ -1,4 +1,4 @@
FROM donaldduck70/sapjvm8:8.1.046
FROM donaldduck70/sapjvm8:8.1.048
LABEL maintainer=axel.uhl@sap.com
# Download and extract the release
WORKDIR /home/sailing/servers/server
+1 -1
View File
@@ -6,7 +6,7 @@ ENV JAVA_HOME=/opt/sapjvm_8
WORKDIR /opt
RUN apt-get update \
&& apt-get install -y wget unzip \
&& curl --cookie eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt "https://tools.hana.ondemand.com/additional/sapjvm-8.1.046-linux-x64.zip" --output sapjvm8-linux-x64.zip \
&& curl --cookie eula_3_1_agreed=tools.hana.ondemand.com/developer-license-3_1.txt "https://tools.hana.ondemand.com/additional/sapjvm-8.1.048-linux-x64.zip" --output sapjvm8-linux-x64.zip \
&& unzip sapjvm8-linux-x64.zip \
&& rm sapjvm8-linux-x64.zip \
&& echo "export JAVA_HOME=/opt/sapjvm_8; export PATH=\${PATH}:/opt/sapjvm_8/bin" > /etc/profile.d/javahome.sh
+2 -1
View File
@@ -1,5 +1,6 @@
#Tue Jan 15 10:13:25 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+1 -1
View File
@@ -34,7 +34,7 @@ SAP is at the center of today’s technology revolution, developing innovations
* [[EC2 Backup Strategy|wiki/info/landscape/amazon-ec2-backup-strategy]]
* [[Creating an EC2 image from scratch|wiki/info/landscape/creating-ec2-image-from-scratch]]
* [[Creating a webserver EC2 image from scratch|wiki/info/landscape/creating-ec2-image-for-webserver-from-scratch]]
* [[EC2 mail relaying|wiki/info/landscape/mail-relaying]]
* [[EC2 mail relaying vs. Amazon Simple E-Mail Service (SES)|wiki/info/landscape/mail-relaying]]
* [[Creating an EC2 image for a MongoDB Replica Set from scratch|wiki/info/landscape/creating-ec2-mongodb-image-from-scratch]]
* [[Setting up dedicated S3 buckets|wiki/info/landscape/s3-bucket-setup]]
* [[Building and Deploying|wiki/info/landscape/building-and-deploying]]
@@ -35,9 +35,11 @@ import com.google.gwt.ajaxloader.client.AjaxLoader.AjaxLoaderOptions;
public class LoadApi {
/**
* Note: If you use 3, it will take the newest stable available. Don't want that. We didn't test with that yet!
* Note: If you use 3, it will take the newest stable available. We want that, although we didn't test with that yet!
* Google Release notes: https://developers.google.com/maps/documentation/javascript/releases.
* Subscribe to https://groups.google.com/forum/#!forum/google-maps-js-api-v3-notify for change notifications.
*/
public final static String API_VERSION = "3.32";
public final static String API_VERSION = "3";
/**
* Libraries not loaded by default <br>
@@ -709,8 +709,10 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
}
if (dbScoreCorrectionForCompetitorInRace
.containsKey(FieldNames.LEADERBOARD_CORRECTED_SCORE.name())) {
final Double leaderboardCorrectedScore = dbScoreCorrectionForCompetitorInRace
.getDouble(FieldNames.LEADERBOARD_CORRECTED_SCORE.name());
final Number dbScoreCorrectionForCompetitorInRaceAsNumber = (Number) dbScoreCorrectionForCompetitorInRace
.get(FieldNames.LEADERBOARD_CORRECTED_SCORE.name());
final Double leaderboardCorrectedScore = dbScoreCorrectionForCompetitorInRaceAsNumber == null ? null :
dbScoreCorrectionForCompetitorInRaceAsNumber.doubleValue();
correctionsToUpdate.correctScoreByID(competitorId, raceColumn, leaderboardCorrectedScore);
}
}
@@ -139,9 +139,9 @@ public class SimpleGridFileReadingTest {
// alternatively for the 4-6 day forecast: http://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.oceanic/VP.004-007/
// validate graphically at http://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.oceanic/VP.004-007/
final Formatter errorLog = new Formatter(System.err);
Files.copy(new URL("http://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.wdir.bin").openStream(),
Files.copy(new URL("https://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.wdir.bin").openStream(),
new File("resources/ds.wdir.bin").toPath(), StandardCopyOption.REPLACE_EXISTING);
Files.copy(new URL("http://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.wspd.bin").openStream(),
Files.copy(new URL("https://tgftp.nws.noaa.gov/SL.us008001/ST.expr/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.wspd.bin").openStream(),
new File("resources/ds.wspd.bin").toPath(), StandardCopyOption.REPLACE_EXISTING);
FeatureDataset dataSetDirection = FeatureDatasetFactoryManager.open(FeatureType.ANY, "resources/ds.wdir.bin", /* task */ null, errorLog);
@@ -18,7 +18,6 @@ import org.apache.shiro.SecurityUtils;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.sap.sailing.domain.common.security.Permission;
import com.sap.sailing.domain.common.security.Permission.Mode;
import com.sap.sailing.server.interfaces.RacingEventService;
@@ -51,11 +50,12 @@ import com.sap.sse.datamining.shared.impl.dto.QueryResultDTO;
import com.sap.sse.datamining.shared.impl.dto.ReducedDimensionsDTO;
import com.sap.sse.datamining.shared.impl.dto.StoredDataMiningQueryDTOImpl;
import com.sap.sse.datamining.ui.client.DataMiningService;
import com.sap.sse.gwt.dispatch.servlets.ProxiedRemoteServiceServlet;
import com.sap.sse.i18n.ResourceBundleStringMessages;
import com.sap.sse.security.SecurityService;
import com.sap.sse.util.ServiceTrackerFactory;
public class DataMiningServiceImpl extends RemoteServiceServlet implements DataMiningService {
public class DataMiningServiceImpl extends ProxiedRemoteServiceServlet implements DataMiningService {
private static final long serialVersionUID = -7951930891674894528L;
private final BundleContext context;
@@ -3618,8 +3618,13 @@ public class SailingServiceImpl extends ProxiedRemoteServiceServlet implements S
final TimeRange timeRange = competitorTimeRanges.get(competitorDTO);
final TimePoint from = timeRange.from(), to = timeRange.to();
final RunnableFuture<List<ManeuverDTO>> future = new FutureTask<>(() -> {
final Iterable<Maneuver> maneuvers = trackedRace.getManeuvers(competitor, from, to,
/* waitForLatest */ true);
// We're on a web server request thread. Try not to take too long for this,
// so don't wait for the latest results unless the cache doesn't have a valid
// result yet:
Iterable<Maneuver> maneuvers = trackedRace.getManeuvers(competitor, from, to, /* waitForLatest */ false);
if (maneuvers == null) {
maneuvers = trackedRace.getManeuvers(competitor, from, to, /* waitForLatest */ true);
}
return createManeuverDTOsForCompetitor(maneuvers, trackedRace, competitor);
});
executor.execute(future);
@@ -17,6 +17,7 @@ import com.sap.sailing.server.interfaces.RacingEventService;
import com.sap.sse.InvalidDateException;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.util.DateParser;
import com.sun.jersey.api.core.ResourceContext;
@@ -49,6 +50,12 @@ public abstract class AbstractSailingServerResource {
return tracker.getService();
}
public ReplicationService getReplicationService() {
@SuppressWarnings("unchecked")
ServiceTracker<ReplicationService, ReplicationService> tracker = (ServiceTracker<ReplicationService, ReplicationService>) servletContext.getAttribute(RestServletContainer.REPLICATION_SERVICE_TRACKER_NAME);
return tracker.getService();
}
protected Regatta findRegattaByName(String regattaName) {
Regatta regatta = getService().getRegattaByName(regattaName);
if (regatta == null && regattaName.contains(SLASH_ENCODING)) {
@@ -9,6 +9,7 @@ import org.osgi.util.tracker.ServiceTracker;
import com.sap.sailing.server.interfaces.RacingEventService;
import com.sap.sse.datamining.DataMiningServer;
import com.sap.sse.replication.ReplicationService;
import com.sun.jersey.spi.container.servlet.ServletContainer;
public class RestServletContainer extends ServletContainer {
@@ -18,10 +19,14 @@ public class RestServletContainer extends ServletContainer {
public static final String RACING_EVENT_SERVICE_TRACKER_NAME = "racingEventServiceTracker";
public static final String REPLICATION_SERVICE_TRACKER_NAME = "replicationServiceTracker";
public static final String DATA_MINING_SERVER_TRACKER_NAME = "dataMiningServerTracker";
private ServiceTracker<RacingEventService, RacingEventService> racingEventServiceTracker;
private ServiceTracker<ReplicationService, ReplicationService> replicationServiceTracker;
private ServiceTracker<DataMiningServer, DataMiningServer> dataMiningServerTracker;
public RestServletContainer() {
@@ -42,9 +47,12 @@ public class RestServletContainer extends ServletContainer {
BundleContext context = (BundleContext) config.getServletContext().getAttribute(OSGI_RFC66_WEBBUNDLE_BUNDLECONTEXT_NAME);
racingEventServiceTracker = new ServiceTracker<RacingEventService, RacingEventService>(context, RacingEventService.class.getName(), null);
racingEventServiceTracker.open();
replicationServiceTracker = new ServiceTracker<ReplicationService, ReplicationService>(context, ReplicationService.class.getName(), null);
replicationServiceTracker.open();
dataMiningServerTracker = new ServiceTracker<DataMiningServer, DataMiningServer>(context, DataMiningServer.class, null);
dataMiningServerTracker.open();
config.getServletContext().setAttribute(RACING_EVENT_SERVICE_TRACKER_NAME, racingEventServiceTracker);
config.getServletContext().setAttribute(REPLICATION_SERVICE_TRACKER_NAME, replicationServiceTracker);
config.getServletContext().setAttribute(DATA_MINING_SERVER_TRACKER_NAME, dataMiningServerTracker);
}
@@ -1144,22 +1144,17 @@ public class RegattasResource extends AbstractSailingServerResource {
} else {
startTime = trackedRace.getStartOfRace();
}
for (Competitor competitor : competitors) {
if (competitorFilter == null || competitor.getId().equals(competitorFilter)) {
Iterable<Maneuver> maneuversForCompetitor = trackedRace.getManeuvers(competitor, startTime,
endTime, false);
Iterable<Maneuver> maneuversForCompetitor = trackedRace.getManeuvers(competitor, startTime, endTime, false);
data.add(new Pair<Competitor, Iterable<Maneuver>>(competitor, maneuversForCompetitor));
}
}
ManeuversJsonSerializer serializer = new ManeuversJsonSerializer(
new ManeuverJsonSerializer(new GPSFixJsonSerializer(), new DistanceJsonSerializer()));
JSONObject jsonMarkPassings = serializer.serialize(data);
String json = jsonMarkPassings.toJSONString();
return Response.ok(json).header("Content-Type", MediaType.APPLICATION_JSON + ";charset=UTF-8")
.build();
return Response.ok(json).header("Content-Type", MediaType.APPLICATION_JSON + ";charset=UTF-8").build();
}
}
}
@@ -1,5 +1,6 @@
package com.sap.sailing.server.gateway.jaxrs.api;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -10,6 +11,8 @@ import org.json.simple.JSONObject;
import com.sap.sailing.server.gateway.jaxrs.AbstractSailingServerResource;
import com.sap.sailing.server.interfaces.RacingEventService;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.ReplicationStatus;
@Path("/v1/status")
public class StatusResource extends AbstractSailingServerResource {
@@ -20,10 +23,15 @@ public class StatusResource extends AbstractSailingServerResource {
final RacingEventService service = getService();
result.put("numberofracestorestore", service.getNumberOfTrackedRacesToRestore());
result.put("numberofracesrestored", service.getNumberOfTrackedRacesRestored());
result.put("isreplica", service.getMasterDescriptor() != null);
result.put("initialloadrunning", service.isCurrentlyFillingFromInitialLoad());
result.put("available", service.getNumberOfTrackedRacesRestored() >= service.getNumberOfTrackedRacesToRestore() &&
(service.getMasterDescriptor() == null || !service.isCurrentlyFillingFromInitialLoad()));
return Response.ok(result.toJSONString()).header("Content-Type", MediaType.APPLICATION_JSON + ";charset=UTF-8").build();
final ReplicationService replicationService = getReplicationService();
final ReplicationStatus replicationStatus = replicationService == null ? null : replicationService.getStatus();
if (replicationStatus != null) {
result.put("replication", replicationStatus.toJSONObject());
}
final boolean available = service.getNumberOfTrackedRacesRestored() >= service.getNumberOfTrackedRacesToRestore() &&
(replicationStatus == null || replicationStatus.isAvailable());
result.put("available", available);
return Response.status(available ? HttpServletResponse.SC_OK : HttpServletResponse.SC_SERVICE_UNAVAILABLE).
entity(result.toJSONString()).header("Content-Type", MediaType.APPLICATION_JSON + ";charset=UTF-8").build();
}
}
@@ -176,8 +176,8 @@ public interface TaggingService {
* @return list of {@link TagDTO tags}, empty list in case an error occurs or there are no tags available but
* <b>never null</b>!
* @param searchSince
* tags will only be returned if they got created after this {@link Timepoint time point}. Set this value
* to <code>null</code> to return all found tags independant of their creation date.
* tags will only be returned if they got created after this {@link TimePoint time point}. Set this value
* to <code>null</code> to return all found tags independent of their creation date.
* @param returnRevokedTags
* if set to <code>true</code> only valid tags will be returned, if set to <code>false</code> revoked
* tags will be returned also
@@ -1,16 +1,25 @@
package com.sap.sse.gwt.dispatch.servlets;
import java.io.IOException;
import java.util.Arrays;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.google.gwt.user.client.rpc.SerializationException;
import com.google.gwt.user.server.rpc.RPCRequest;
import com.google.gwt.user.server.rpc.RPCServletUtils;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.google.gwt.user.server.rpc.SerializationPolicy;
import com.sap.sse.common.Duration;
import com.sap.sse.common.TimePoint;
import com.sap.sse.common.Util.Triple;
import com.sap.sse.common.impl.MillisecondsTimePoint;
import com.sap.sse.gwt.shared.RpcConstants;
/**
@@ -18,7 +27,11 @@ import com.sap.sse.gwt.shared.RpcConstants;
* when using GWT-RPC. This is due to the fact that GWT doesn't find the correct
* serialization rule file. For non proxyfied environments you do not need to change
* anything. In an Apache based env you need to add a line like the following to your
* configuration: RequestHeader edit X-GWT-Module-Base sapsailing.com/(gwt/)? sapsailing.com/gwt/
* configuration: RequestHeader edit X-GWT-Module-Base sapsailing.com/(gwt/)? sapsailing.com/gwt/<p>
*
* This servlet additionally measures the response time that this servlet takes for each request.
* Should the response time exceed {@link #LOG_REQUESTS_TAKING_LONGER_THAN} then the request
* will be logged.
*
* @author Simon Pamies (info@pamies.de)
* @since Oct 10, 2012
@@ -26,6 +39,20 @@ import com.sap.sse.gwt.shared.RpcConstants;
public abstract class ProxiedRemoteServiceServlet extends RemoteServiceServlet {
private static final long serialVersionUID = 5379097888921157936L;
private static final Duration LOG_REQUESTS_TAKING_LONGER_THAN = Duration.ONE_SECOND.times(2);
private static final Logger logger = Logger.getLogger(ProxiedRemoteServiceServlet.class.getName());
/**
* The {@link #processCall(RPCRequest)} override in this class records the start and the end time points
* of the processing of each request. The {@link #service(HttpServletRequest, HttpServletResponse)} method
* uses this, after having delegated to the superclass method which calls {@link #processCall(RPCRequest)} and
* performs response serialization afterwards. It can thus determine the actual processing duration as well
* as the serialization durations. Should the total exceed {@link #LOG_REQUESTS_TAKING_LONGER_THAN}, the
* request will be logged.
*/
private static final ThreadLocal<Triple<RPCRequest, TimePoint, TimePoint>> processingStartAndFinishTime = new ThreadLocal<>();
@Override
protected SerializationPolicy doGetSerializationPolicy(
@@ -85,4 +112,32 @@ public abstract class ProxiedRemoteServiceServlet extends RemoteServiceServlet {
// Using default locale if the client locale could not be determined
return Locale.ENGLISH;
}
@Override
public String processCall(RPCRequest rpcRequest) throws SerializationException {
final TimePoint startOfRequestProcessing = MillisecondsTimePoint.now();
final String result = super.processCall(rpcRequest);
processingStartAndFinishTime.set(new Triple<>(rpcRequest, startOfRequestProcessing, MillisecondsTimePoint.now()));
return result;
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
super.service(req, resp);
final TimePoint afterResultSerialization = MillisecondsTimePoint.now();
final Triple<RPCRequest, TimePoint, TimePoint> startAndEndOfProcessing = processingStartAndFinishTime.get();
final Duration totalTime = startAndEndOfProcessing.getB().until(afterResultSerialization);
if (totalTime.compareTo(LOG_REQUESTS_TAKING_LONGER_THAN) > 0) {
logRequest(startAndEndOfProcessing.getA(), startAndEndOfProcessing.getB(), startAndEndOfProcessing.getC(), afterResultSerialization);
}
}
private void logRequest(RPCRequest request, TimePoint startOfProcessing, TimePoint endOfProcessing, TimePoint afterResultSerialization) {
final Duration processingDuration = startOfProcessing.until(endOfProcessing);
final Duration serializationDuration = endOfProcessing.until(afterResultSerialization);
final Duration totalDuration = startOfProcessing.until(afterResultSerialization);
logger.log(Level.WARNING, "GWT RPC Request "+request.getMethod()+" with parameters "+Arrays.toString(request.getParameters())+" on "+this+
" took "+processingDuration+" to process, "+serializationDuration+" to serialize the response, so "+
totalDuration+" in total.");
}
}
@@ -7,7 +7,8 @@ Bundle-Vendor: SAP
Automatic-Module-Name: com.sap.sse.replication.interfaces
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.sap.sse.replication
Import-Package: com.rabbitmq.client;version="2.8.4"
Import-Package: com.rabbitmq.client;version="2.8.4",
org.json.simple
Require-Bundle: com.sap.sse.operationaltransformation;bundle-version="1.0.0",
com.sap.sse.common;bundle-version="1.0.0",
com.sap.sse;bundle-version="1.0.0"
@@ -121,4 +121,10 @@ public interface ReplicationService {
*
*/
boolean isReplicationStarting();
/**
* Provides a compound overview of this service and the {@link Replicable}s it manages.
* This can be used in compound server availability checks, for example.
*/
ReplicationStatus getStatus();
}
@@ -0,0 +1,44 @@
package com.sap.sse.replication;
import org.json.simple.JSONObject;
public interface ReplicationStatus {
boolean isReplica();
boolean isReplicationStarting();
boolean isSuspended();
boolean isStopped();
long getMessageQueueLength();
Iterable<String> getReplicableIdsAsStrings();
/**
* The queue length or {@code null} if no queue exists for the replicable with ID {@link code replicableIdAsString}
*/
Integer getOperationQueueLengthsByReplicableIdAsString(String replicableIdAsString);
int getTotalOperationQueueLength();
/**
* @return {@code true} if the initial load for the replicable with ID {@link code replicableIdAsString} is
* currently running, {@code false} if not, and {@code null} if the replicable with ID {@link code replicableIdAsString}
* is not known.
*/
Boolean isInitialLoadRunning(String replicableIdAsString);
/**
* An availability report based on the replication status of the overall service and all of the
* {@link Replicable}s managed by it. This method reports {@code true} if this server is not a replica,
* or in case it is a replica the replication is not currently starting and no initial load is currently
* running for any replicable managed by this service.<p>
*
* Note that if this server is not a replica there may still be other start-up processes going on, such as
* the restoring of races that need to be loaded.
*/
boolean isAvailable();
JSONObject toJSONObject();
}
@@ -123,50 +123,64 @@ public class Activator implements BundleActivator {
final OSGiReplicableTracker replicablesProvider = new OSGiReplicableTracker(bundleContext);
serverReplicationMasterService = new ReplicationServiceImpl(
exchangeName, exchangeHost, exchangePort, replicationInstancesManager, replicablesProvider);
String replicateOnStart = System.getProperty(PROPERTY_NAME_REPLICATE_ON_START);
final boolean autoReplicationRequested = replicateOnStart != null && !replicateOnStart.isEmpty();
if (autoReplicationRequested) {
// set before registering the service; clients discovering it therefore cannot accidentally
// discover it before this flag has been set.
serverReplicationMasterService.setReplicationStarting(true);
}
bundleContext.registerService(ReplicationService.class, serverReplicationMasterService, null);
logger.info("Registered replication service "+serverReplicationMasterService+" using exchange name "+exchangeName+" on host "+exchangeHost);
checkIfAutomaticReplicationShouldStart(serverReplicationMasterService, exchangeName, replicablesProvider);
if (autoReplicationRequested) {
triggerAutomaticReplication(serverReplicationMasterService, replicateOnStart, exchangeName, replicablesProvider);
}
}
private void checkIfAutomaticReplicationShouldStart(ReplicationService serverReplicationMasterService, String masterExchangeName, final ReplicablesProvider replicablesProvider) {
String replicateOnStart = System.getProperty(PROPERTY_NAME_REPLICATE_ON_START);
if (replicateOnStart != null && !replicateOnStart.isEmpty()) {
serverReplicationMasterService.setReplicationStarting(true);
final String[] replicableIdsAsStrings = replicateOnStart.split(",");
new Thread("ServiceTracker waiting for Replicables "+Arrays.toString(replicableIdsAsStrings)) {
@Override
public void run() {
logger.info("Waiting for Replicables " + Arrays.toString(replicableIdsAsStrings) +
" before firing up replication automatically...");
final List<Replicable<?, ?>> replicables = new ArrayList<>();
for (String replicableIdAsString : replicableIdsAsStrings) {
Replicable<?, ?> replicable = replicablesProvider.getReplicable(replicableIdAsString, /* wait */true);
logger.info("Obtained Replicable " + replicableIdAsString);
replicables.add(replicable);
}
logger.info("Configuration requested automatic replication for replicables "+
Arrays.toString(replicableIdsAsStrings)+". Starting it up...");
String replicateFromExchangeName = System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_EXCHANGE_NAME);
if (replicateFromExchangeName == null) {
replicateFromExchangeName = masterExchangeName;
}
ReplicationMasterDescriptorImpl master = new ReplicationMasterDescriptorImpl(
System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_QUEUE_HOST),
replicateFromExchangeName,
Integer.valueOf(System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_QUEUE_PORT).trim()),
serverReplicationMasterService.getServerIdentifier().toString(),
System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_SERVLET_HOST),
Integer.valueOf(System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_SERVLET_PORT).trim()), replicables);
try {
serverReplicationMasterService.startToReplicateFrom(master);
serverReplicationMasterService.setReplicationStarting(false);
logger.info("Automatic replication has been started.");
} catch (ClassNotFoundException | IOException | InterruptedException e) {
logger.log(Level.SEVERE, "Error with automatic replication from "+master, e);
}
/**
* Assumes that automatic replication was requested and that the {@code serverReplicationMasterService} has already been
* marked as {@link ReplicationService#setReplicationStarting(boolean) setReplicationStarting(true)}. When replication
* has been requested from all replicables, {@link ReplicationService#setReplicationStarting(boolean) setReplicationStarting(false)}
* will be called by this method to indicate that the start-up sequence for the service has completed; now clients may need
* to wait for the individual replicables to finish their initial load.
*/
private void triggerAutomaticReplication(ReplicationService serverReplicationMasterService, String replicateOnStart, String masterExchangeName, final ReplicablesProvider replicablesProvider) {
assert replicateOnStart != null && !replicateOnStart.isEmpty();
serverReplicationMasterService.setReplicationStarting(true);
final String[] replicableIdsAsStrings = replicateOnStart.split(",");
new Thread("ServiceTracker waiting for Replicables "+Arrays.toString(replicableIdsAsStrings)) {
@Override
public void run() {
logger.info("Waiting for Replicables " + Arrays.toString(replicableIdsAsStrings) +
" before firing up replication automatically...");
final List<Replicable<?, ?>> replicables = new ArrayList<>();
for (String replicableIdAsString : replicableIdsAsStrings) {
Replicable<?, ?> replicable = replicablesProvider.getReplicable(replicableIdAsString, /* wait */true);
logger.info("Obtained Replicable " + replicableIdAsString);
replicables.add(replicable);
}
}.start();
}
logger.info("Configuration requested automatic replication for replicables "+
Arrays.toString(replicableIdsAsStrings)+". Starting it up...");
String replicateFromExchangeName = System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_EXCHANGE_NAME);
if (replicateFromExchangeName == null) {
replicateFromExchangeName = masterExchangeName;
}
ReplicationMasterDescriptorImpl master = new ReplicationMasterDescriptorImpl(
System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_QUEUE_HOST),
replicateFromExchangeName,
Integer.valueOf(System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_QUEUE_PORT).trim()),
serverReplicationMasterService.getServerIdentifier().toString(),
System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_SERVLET_HOST),
Integer.valueOf(System.getProperty(PROPERTY_NAME_REPLICATE_MASTER_SERVLET_PORT).trim()), replicables);
try {
serverReplicationMasterService.startToReplicateFrom(master);
serverReplicationMasterService.setReplicationStarting(false);
logger.info("Automatic replication has been started.");
} catch (ClassNotFoundException | IOException | InterruptedException e) {
logger.log(Level.SEVERE, "Error with automatic replication from "+master, e);
}
}
}.start();
}
public void stop(BundleContext bundleContext) throws Exception {
@@ -45,6 +45,7 @@ import com.sap.sse.replication.ReplicablesProvider.ReplicableLifeCycleListener;
import com.sap.sse.replication.ReplicationMasterDescriptor;
import com.sap.sse.replication.ReplicationReceiver;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.ReplicationStatus;
import com.sap.sse.util.HttpUrlConnectionHelper;
import net.jpountz.lz4.LZ4BlockInputStream;
@@ -840,4 +841,30 @@ public class ReplicationServiceImpl implements ReplicationService, OperationsToM
public <S, O extends OperationWithResult<S, ?>, T> void scheduleForSending(OperationWithResult<S, T> operationWithResult, OperationsToMasterSender<S, O> sender) {
unsentOperationsSenderJob.scheduleForSending(operationWithResult, sender);
}
@Override
public synchronized ReplicationStatus getStatus() {
final ReplicationReceiver replicationReceiver = getReplicator();
final boolean isReplicationStarting = isReplicationStarting();
final boolean isReplica = isReplicationStarting || replicationReceiver != null;
final boolean suspended = replicationReceiver == null ? false : replicationReceiver.isSuspended();
final boolean stopped = replicationReceiver == null ? false : replicationReceiver.isBeingStopped();
long messageQueueLength;
if (replicationReceiver == null) {
messageQueueLength = 0;
} else {
try {
messageQueueLength = replicationReceiver.getMessageQueueSize();
} catch (IllegalAccessException e) {
logger.warning("Unable to access replication message queue size: "+e.getMessage()+". Reporting as -1");
messageQueueLength = -1;
}
}
final Map<String, Integer> operationQueueLengths = replicationReceiver == null ? new HashMap<>() : replicationReceiver.getOperationQueueSizes();
final Map<String, Boolean> isInitialLoadRunning = new HashMap<>();
for (final Replicable<?, ?> replicable : getAllReplicables()) {
isInitialLoadRunning.put(replicable.getId().toString(), replicable.isCurrentlyFillingFromInitialLoad());
}
return new ReplicationStatusImpl(isReplica, isReplicationStarting, suspended, stopped, messageQueueLength, isInitialLoadRunning, operationQueueLengths);
}
}
@@ -9,7 +9,6 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Date;
import java.util.Map.Entry;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -29,8 +28,8 @@ import com.sap.sse.replication.OperationWithResult;
import com.sap.sse.replication.ReplicaDescriptor;
import com.sap.sse.replication.Replicable;
import com.sap.sse.replication.ReplicablesProvider;
import com.sap.sse.replication.ReplicationReceiver;
import com.sap.sse.replication.ReplicationService;
import com.sap.sse.replication.ReplicationStatus;
import com.sap.sse.util.impl.CountingOutputStream;
import net.jpountz.lz4.LZ4BlockInputStream;
@@ -182,41 +181,42 @@ public class ReplicationServlet extends AbstractHttpServlet {
private void reportStatus(HttpServletResponse resp) throws IllegalAccessException, IOException {
final JSONObject result = new JSONObject();
final JSONArray replicablesJSON = new JSONArray();
synchronized (getReplicationService()) {
final ReplicationReceiver replicationReceiver = getReplicationService().getReplicator();
final boolean isReplicationStarting = getReplicationService().isReplicationStarting();
final boolean isReplica = isReplicationStarting || replicationReceiver != null;
result.put("replica", isReplica);
result.put("replicationstarting", isReplicationStarting);
result.put("suspended", replicationReceiver == null ? false : replicationReceiver.isSuspended());
result.put("stopped", replicationReceiver == null ? false : replicationReceiver.isBeingStopped());
result.put("messagequeuelength", replicationReceiver == null ? 0 : replicationReceiver.getMessageQueueSize());
final JSONArray operationQueueLengths = new JSONArray();
result.put("operationqueuelengths", operationQueueLengths);
int totalOperationQueueLengths = 0;
if (replicationReceiver != null) {
for (final Entry<String, Integer> queueLength : replicationReceiver.getOperationQueueSizes().entrySet()) {
final JSONObject queueLengthJSON = new JSONObject();
queueLengthJSON.put("id", queueLength.getKey());
queueLengthJSON.put("length", queueLength.getValue());
totalOperationQueueLengths += queueLength.getValue();
operationQueueLengths.add(queueLengthJSON);
}
final ReplicationStatus status = getReplicationService().getStatus();
result.put("replica", status.isReplica());
result.put("replicationstarting", status.isReplicationStarting());
result.put("suspended", status.isSuspended());
result.put("stopped", status.isStopped());
result.put("messagequeuelength", status.getMessageQueueLength());
final JSONArray operationQueueLengths = new JSONArray();
result.put("operationqueuelengths", operationQueueLengths);
for (final String replicableIdAsString : status.getReplicableIdsAsStrings()) {
Integer queueLength = status.getOperationQueueLengthsByReplicableIdAsString(replicableIdAsString);
if (queueLength != null) {
final JSONObject queueLengthJSON = new JSONObject();
queueLengthJSON.put("id", replicableIdAsString);
queueLengthJSON.put("length", queueLength);
operationQueueLengths.add(queueLengthJSON);
}
result.put("totaloperationqueuelength", totalOperationQueueLengths);
boolean initialLoadRunning = false;
for (final Replicable<?, ?> replicable : getReplicationService().getAllReplicables()) {
}
result.put("totaloperationqueuelength", status.getTotalOperationQueueLength());
for (final String replicableIdAsString : status.getReplicableIdsAsStrings()) {
Boolean initialLoadRunning = status.isInitialLoadRunning(replicableIdAsString);
if (initialLoadRunning != null) {
final JSONObject replicableJSON = new JSONObject();
replicableJSON.put("id", replicable.getId());
replicableJSON.put("initialloadrunning", replicable.isCurrentlyFillingFromInitialLoad());
initialLoadRunning = initialLoadRunning || replicable.isCurrentlyFillingFromInitialLoad();
replicableJSON.put("id", replicableIdAsString);
replicableJSON.put("initialloadrunning", initialLoadRunning);
replicablesJSON.add(replicableJSON);
}
result.put("replicables", replicablesJSON);
result.put("available", !isReplica || (!isReplicationStarting && !initialLoadRunning));
}
result.put("replicables", replicablesJSON);
result.put("available", status.isAvailable());
resp.setContentType("application/json;charset=UTF-8");
resp.getWriter().print(result.toJSONString());
if (status.isAvailable()) {
resp.setStatus(HttpServletResponse.SC_OK);
} else {
resp.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
}
}
/**
@@ -0,0 +1,133 @@
package com.sap.sse.replication.impl;
import java.util.Collections;
import java.util.Map;
import java.util.Map.Entry;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import com.sap.sse.replication.ReplicationStatus;
public class ReplicationStatusImpl implements ReplicationStatus {
private final boolean isReplica;
private final boolean isReplicationStarting;
private final boolean isSuspended;
private final boolean isStopped;
private final long messageQueueLength;
private final Map<String, Boolean> isInitialLoadRunning;
private final Map<String, Integer> operationQueueLengths;
public ReplicationStatusImpl(boolean isReplica, boolean isReplicationStarting, boolean isSuspended,
boolean isStopped, long messageQueueLength, Map<String, Boolean> isInitialLoadRunning,
Map<String, Integer> operationQueueLengths) {
super();
this.isReplica = isReplica;
this.isReplicationStarting = isReplicationStarting;
this.isSuspended = isSuspended;
this.isStopped = isStopped;
this.messageQueueLength = messageQueueLength;
this.isInitialLoadRunning = isInitialLoadRunning;
this.operationQueueLengths = operationQueueLengths;
}
@Override
public boolean isReplica() {
return isReplica;
}
@Override
public boolean isReplicationStarting() {
return isReplicationStarting;
}
@Override
public boolean isSuspended() {
return isSuspended;
}
@Override
public boolean isStopped() {
return isStopped;
}
@Override
public long getMessageQueueLength() {
return messageQueueLength;
}
@Override
public Iterable<String> getReplicableIdsAsStrings() {
return Collections.unmodifiableMap(isInitialLoadRunning).keySet();
}
@Override
public Integer getOperationQueueLengthsByReplicableIdAsString(String replicableIdAsString) {
return operationQueueLengths.get(replicableIdAsString);
}
@Override
public int getTotalOperationQueueLength() {
int result = 0;
for (Entry<String, Integer> e : operationQueueLengths.entrySet()) {
result += e.getValue();
}
return result;
}
@Override
public Boolean isInitialLoadRunning(String replicableIdAsString) {
return isInitialLoadRunning.get(replicableIdAsString);
}
@Override
public boolean isAvailable() {
return !isReplica() || (!isReplicationStarting() && !isInitialLoadRunning());
}
/**
* Tells whether the initial load is running for any of the replicables known
*/
private boolean isInitialLoadRunning() {
boolean result = false;
for (boolean initialLoadRunning : isInitialLoadRunning.values()) {
result |= initialLoadRunning;
}
return result;
}
@Override
public JSONObject toJSONObject() {
final JSONObject result = new JSONObject();
final JSONArray replicablesJSON = new JSONArray();
result.put("replica", this.isReplica());
result.put("replicationstarting", this.isReplicationStarting());
result.put("suspended", this.isSuspended());
result.put("stopped", this.isStopped());
result.put("messagequeuelength", this.getMessageQueueLength());
final JSONArray operationQueueLengths = new JSONArray();
result.put("operationqueuelengths", operationQueueLengths);
for (final String replicableIdAsString : this.getReplicableIdsAsStrings()) {
Integer queueLength = this.getOperationQueueLengthsByReplicableIdAsString(replicableIdAsString);
if (queueLength != null) {
final JSONObject queueLengthJSON = new JSONObject();
queueLengthJSON.put("id", replicableIdAsString);
queueLengthJSON.put("length", queueLength);
operationQueueLengths.add(queueLengthJSON);
}
}
result.put("totaloperationqueuelength", this.getTotalOperationQueueLength());
for (final String replicableIdAsString : this.getReplicableIdsAsStrings()) {
Boolean initialLoadRunning = this.isInitialLoadRunning(replicableIdAsString);
if (initialLoadRunning != null) {
final JSONObject replicableJSON = new JSONObject();
replicableJSON.put("id", replicableIdAsString);
replicableJSON.put("initialloadrunning", initialLoadRunning);
replicablesJSON.add(replicableJSON);
}
}
result.put("replicables", replicablesJSON);
result.put("available", this.isAvailable());
return result;
}
}
@@ -38,8 +38,10 @@ public class UnsentOperationsSenderJob implements OperationsToMasterSendingQueue
private boolean scheduled;
/**
* Something between {@link Duration#NULL} and {@link #MAX_WAIT_TIME_BETWEEN_ATTEMPTS}, indicating
* the time to wait before trying the next re-send.
* Something greater than {@link Duration#NULL} and less than or equal to {@link #MAX_WAIT_TIME_BETWEEN_ATTEMPTS},
* indicating the time to wait before trying the next re-send. {@link Duration#NULL} means that the next message
* added to the queue will be handled immediately and synchronously, and only if sending fails, a background task
* will be scheduled for later sending, then with a positive wait duration.
*/
private Duration nextWaitDuration;
@@ -53,11 +55,28 @@ public class UnsentOperationsSenderJob implements OperationsToMasterSendingQueue
}
@Override
public synchronized <S, O extends OperationWithResult<S, ?>, T> void scheduleForSending(
public <S, O extends OperationWithResult<S, ?>, T> void scheduleForSending(
OperationWithResult<S, T> operationWithResult,
OperationsToMasterSender<S, O> sender) {
queue.addLast(new Pair<>(operationWithResult, sender));
ensureScheduled();
final boolean runSynchronously;
synchronized (this) {
queue.addLast(new Pair<>(operationWithResult, sender));
runSynchronously = !scheduled;
if (!scheduled) {
// try to send immediately; setting scheduled to true will cause subsequent operation
// submissions to be picked up by that run() call as long as they arrive before the run()
// method resets scheduled to false and returns.
scheduled = true;
}
}
// This way, calling the run() method happens outside of the synchronized block above, and
// so other threads may insert operations into the queue while the run() method is trying
// to send, which will then be picked up by any
// synchronous call to run() triggered in the next block:
if (runSynchronously) {
// In case of a send error, the run() method will itself re-schedule
run();
}
}
/**
@@ -84,7 +103,7 @@ public class UnsentOperationsSenderJob implements OperationsToMasterSendingQueue
} else {
sendOk = false;
}
synchronized (this) { // FIXME synchronization too coarse-grained
synchronized (this) {
if (sendOk) {
resetWaitDuration();
queue.removeFirst();
@@ -42,7 +42,8 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
Util.addToValueSet(sessionsByCacheName, cacheName, session);
}
});
expiredSessionIds.forEach(id->sessionsCollection.deleteOne(new Document(FieldNames.SESSION_ID.name(), id)));
final Document filter = new Document("$in", Util.map(expiredSessionIds, id->id.toString()));
sessionsCollection.deleteMany(new Document(FieldNames.SESSION_ID.name(), filter));
return sessionsByCacheName;
}
@@ -69,9 +69,9 @@ public class ReplicatingCache<K, V> implements Cache<K, V>, Named {
}
V result = cache.put(key, value);
final String myName = name;
securityService.replicate(s->
s.getCacheManager().getCache(myName).put(key, value));
if (store && value instanceof Session) {
securityService.replicate(s->
s.getCacheManager().getCache(myName).put(key, value));
securityService.storeSession(getName(), (Session) value);
}
return result;
@@ -31,7 +31,7 @@
<Arg name="threadpool">
<New id="threadpool" class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Arg name="minThreads" type="int">10</Arg>
<Arg name="maxThreads" type="int">64</Arg>
<Arg name="maxThreads" type="int">250</Arg>
<Arg name="idleTimeout" type="int">25000</Arg>
<Set name="detailedDump">false</Set>
</New>
+6 -7
View File
@@ -27,15 +27,14 @@ echo "JAVA_HOME: $JAVA_HOME"
echo "INSTANCE_ID: $INSTANCE_ID"
echo ""
RACING_EVENT_SERVICE_AVAILABLE=$(curl http://127.0.0.1:$SERVER_PORT/sailingserver/api/v1/status 2>/dev/null | jq .available)
REPLICATION_AVAILABLE=$(curl http://127.0.0.1:$SERVER_PORT/replication/replication?action=STATUS 2>/dev/null | jq .available)
INDEX_HTML_STATUS=$(curl -I http://127.0.0.1:8888/index.html 2>/dev/null | head -n 1 | cut -d ' ' -f 2)
STATUS=$(curl -i http://127.0.0.1:$SERVER_PORT/sailingserver/api/v1/status 2>/dev/null)
RESPONSE_STATUS_CODE=$(echo $STATUS | head -n 1 | cut -d ' ' -f 2)
echo "RACING_EVENT_SERVICE_AVAILABLE: $RACING_EVENT_SERVICE_AVAILABLE"
echo "REPLICATION_AVAILABLE: $REPLICATION_AVAILABLE"
echo "INDEX_HTML_STATUS: $INDEX_HTML_STATUS"
echo "AVAILABILITY_STATUS: $RESPONSE_STATUS_CODE"
echo "AVAILABILITY_DETAILS:"
echo "$STATUS" | grep "^\{" | jq .
if [[ $RACING_EVENT_SERVICE_AVAILABLE == "true" && $REPLICATION_AVAILABLE == "true" && $INDEX_HTML_STATUS =~ 2.. ]]; then
if [[ $RESPONSE_STATUS_CODE =~ 2.. ]]; then
echo "Server $SERVER_NAME is available on $SERVER_PORT"
exit 0
else
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="tests-jvm/src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry combineaccessrules="false" kind="src" path="/google-android-support-v4"/>
<classpathentry combineaccessrules="false" kind="src" path="/google-android-support-v7-appcompat_lib"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.android.buoy.positioning.app</name>
<comment></comment>
<projects>
</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>
@@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sap.sailing.android.buoy.positioning.app"
android:versionCode="63"
android:versionName="1.4.63">
package="com.sap.sailing.android.buoy.positioning.app">
<uses-sdk />
@@ -39,15 +37,16 @@
android:label="@string/app_name"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data android:scheme="comsapsailingbuoypositioning" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
@@ -3,9 +3,6 @@ if (!project.hasProperty("xmake")) {
apply plugin: "com.getkeepsafe.dexcount"
}
def packageName="com.sap.sailing.android.buoy.positioning.app"
def verCode=1
android {
buildToolsVersion rootProject.ext.buildTools
compileSdkVersion rootProject.ext.compileSdk
@@ -23,35 +20,22 @@ android {
outputFileName = new File(outputFileName.replace("-$variant.buildType.name", ""))
}
variant.assemble.doLast { assemble ->
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, packageName + ".version")
versionFile.text = packageName + ".apk=$verCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
}
def versionPropertiesFile = file('project.properties')
if (versionPropertiesFile.exists()) {
def versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropertiesFile))
verCode = (versionProps['VERSION_CODE'] ?: '0').toInteger()
def runTasks = gradle.startParameter.taskNames
if ('assemble' in runTasks || 'assembleRelease' in runTasks || 'aR' in runTasks) {
verCode = verCode + 1
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, packageName + ".version")
versionFile.text = packageName + ".apk=$appVersionCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
versionProps['VERSION_CODE'] = verCode.toString()
versionProps.store(versionPropertiesFile.newWriter(), null)
}
defaultConfig {
applicationId packageName
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk
versionCode verCode
versionName "$verCode - Altitude"
versionCode appVersionCode.toInteger()
versionName "$appVersionCode - Altitude"
}
sourceSets {
@@ -99,8 +83,6 @@ android {
packagingOptions {
exclude "LICENSE.txt"
exclude "META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties"
exclude "META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml"
}
}
@@ -0,0 +1,3 @@
packageName=com.sap.sailing.android.buoy.positioning.app
appVersionCode=63
appVersionName=1.4.63
@@ -1,166 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.sailing</groupId>
<artifactId>mobile</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.android.buoy.positioning.app</artifactId>
<packaging>apk</packaging>
<properties>
<!-- If you change this name, change in app too! -->
<additional-deployment-version-file>com.sap.sailing.android.buoy.positioning.app.version
</additional-deployment-version-file>
<!-- passed by buildAndUpdateProduct.sh (parsed from AndroidManifest.xml) -->
<app-version>${buoy.positioning-app-version}</app-version>
</properties>
<dependencies>
<dependency>
<groupId>${android.api.groupId}</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.sap.sailing.android.shared</artifactId>
<version>${project.version}</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.16</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/tests-jvm/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>non-leandi</id>
<activation>
<property>
<name>!ldi.releaseBuild</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<!-- If not running on Lean DI we do the signing by ourselves with our own keystore. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for copying the *.apk to com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for creation of *.version files for the *.apk in com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed to clean the app in com.sap.sailing.www project. -->
<artifactId>maven-clean-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-no-realsign</id>
<activation>
<property>
<!-- When running on Lean DI but it's not a release build, we do signing on our own. -->
<name>ldi.releaseType</name>
<value>milestone</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-realsign</id>
<activation>
<property>
<!-- When running on Lean DI and it's a release build, we do SAP signing. -->
<name>ldi.releaseType</name>
<value>customer</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.sap.prd.codesign</groupId>
<artifactId>com.sap.prd.codesign.maven-jarsigner-plugin</artifactId>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin> -->
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,11 +1,8 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -1,5 +0,0 @@
#Sun Jan 06 00:30:22 CET 2019
android.library.reference.3=../licensesdialog_lib/de.psdev.licensesdialog
VERSION_CODE=63
android.library.reference.2=../com.sap.sailing.android.shared
android.library.reference.1=../google-play-services_lib
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.sap.sailing.domain.common"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.sap.sailing.domain.shared.android"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.sap.sse.common"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.sap.sailing.server.gateway.serialization.shared.android"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/com.sap.sse.shared.android"/>
<classpathentry kind="lib" path="/google-play-services_lib/libs/google-play-services.jar"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.json.simple"/>
<classpathentry exported="true" kind="var" path="ANDROID_HOME/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.android.shared</name>
<comment></comment>
<projects>
</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>
@@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,128 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.sailing</groupId>
<artifactId>mobile</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.sap.sailing.android.shared</artifactId>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sse.security.common</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sse.shared.android</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sse.datamining.annotations</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.domain.common</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.domain.shared.android</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.server.gateway.serialization.shared.android</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sse.common</artifactId>
<version>${project.version}</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sap.sailing</groupId>
<artifactId>org.json.simple</artifactId>
<version>1.1.0-SNAPSHOT</version>
<type>aar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-location</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>${android.api.groupId}</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>de.psdev.licensesdialog</groupId>
<artifactId>licensesdialog</artifactId>
<version>1.8.0</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>io.branch.sdk.android</groupId>
<artifactId>library</artifactId>
<version>2.19.2</version>
<type>aar</type>
<exclusions>
<exclusion>
<groupId>com.crashlytics.sdk.android</groupId>
<artifactId>answers-shim</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -1,11 +1,8 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -1,20 +0,0 @@
# 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 edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=Google Inc.:Google APIs:22
android.library=true
android.library.reference.1=../google-android-support-v7-appcompat_lib
android.library.reference.2=../licensesdialog_lib/de.psdev.licensesdialog
android.library.reference.3=../google-android-support-v4
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="src" path="tests-jvm/src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.sap.sailing.domain.common"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.android.tracking.app</name>
<comment></comment>
<projects>
</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>
<filteredResources>
<filter>
<id>1359465261368</id>
<name>src</name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-.svn</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,2 +0,0 @@
eclipse.preferences.version=1
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sap.sailing.android.tracking.app"
android:versionCode="63"
android:versionName="1.4.63">
package="com.sap.sailing.android.tracking.app">
<uses-sdk />
@@ -3,9 +3,6 @@ if (!project.hasProperty("xmake")) {
apply plugin: "com.getkeepsafe.dexcount"
}
def packageName="com.sap.sailing.android.tracking.app"
def verCode=1
android {
buildToolsVersion rootProject.ext.buildTools
compileSdkVersion rootProject.ext.compileSdk
@@ -23,35 +20,22 @@ android {
outputFileName = new File(outputFileName.replace("-$variant.buildType.name", ""))
}
variant.assemble.doLast { assemble ->
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, packageName + ".version")
versionFile.text = packageName + ".apk=$verCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
}
def versionPropertiesFile = file('project.properties')
if (versionPropertiesFile.exists()) {
def versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropertiesFile))
verCode = (versionProps['VERSION_CODE'] ?: '0').toInteger()
def runTasks = gradle.startParameter.taskNames
if ('assemble' in runTasks || 'assembleRelease' in runTasks || 'aR' in runTasks) {
verCode = verCode + 1
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, packageName + ".version")
versionFile.text = packageName + ".apk=$appVersionCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
versionProps['VERSION_CODE'] = verCode.toString()
versionProps.store(versionPropertiesFile.newWriter(), null)
}
defaultConfig {
applicationId packageName
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk
versionCode verCode
versionName "$verCode - Altitude"
versionCode appVersionCode.toInteger()
versionName "$appVersionCode - Altitude"
}
sourceSets {
@@ -99,8 +83,6 @@ android {
packagingOptions {
exclude "LICENSE.txt"
exclude "META-INF/maven/com.googlecode.json-simple/json-simple/pom.properties"
exclude "META-INF/maven/com.googlecode.json-simple/json-simple/pom.xml"
}
}
@@ -0,0 +1,3 @@
packageName=com.sap.sailing.android.tracking.app
appVersionCode=63
appVersionName=1.4.63
@@ -1,173 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.sailing</groupId>
<artifactId>mobile</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.android.tracking.app</artifactId>
<packaging>apk</packaging>
<properties>
<!-- If you change this name, change in app too! -->
<additional-deployment-version-file>com.sap.sailing.android.tracking.app.version</additional-deployment-version-file>
<!-- passed by buildAndUpdateProduct.sh (parsed from AndroidManifest.xml) -->
<app-version>${tracking-app-version}</app-version>
</properties>
<dependencies>
<dependency>
<groupId>${android.api.groupId}</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-gcm</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.sap.sailing.android.shared</artifactId>
<version>${project.version}</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.16</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/tests-jvm/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>non-leandi</id>
<activation>
<property>
<name>!ldi.releaseBuild</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<!-- If not running on Lean DI we do the signing by ourselves with our own keystore. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for copying the *.apk to com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for creation of *.version files for the *.apk in com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed to clean the app in com.sap.sailing.www project. -->
<artifactId>maven-clean-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-no-realsign</id>
<activation>
<property>
<!-- When running on Lean DI but it's not a release build, we do signing on our own. -->
<name>ldi.releaseType</name>
<value>milestone</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-realsign</id>
<activation>
<property>
<!-- When running on Lean DI and it's a release build, we do SAP signing. -->
<name>ldi.releaseType</name>
<value>customer</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.sap.prd.codesign</groupId>
<artifactId>com.sap.prd.codesign.maven-jarsigner-plugin</artifactId>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin> -->
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,11 +1,8 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -1,5 +0,0 @@
#Sun Jan 06 00:30:23 CET 2019
VERSION_CODE=63
android.library.reference.3=../licensesdialog_lib/de.psdev.licensesdialog
android.library.reference.2=../com.sap.sailing.android.shared
android.library.reference.1=../google-play-services_lib
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests-jvm/src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.json.simple"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="/com.sap.sailing.targetplatform.base/plugins/target-test/mockito-core-1.10.14.jar"/>
<classpathentry kind="var" path="ANDROID_HOME/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1,44 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.sap.sailing.racecommittee.app</name>
<comment></comment>
<projects>
</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>
<filteredResources>
<filter>
<id>1359465261368</id>
<name>src</name>
<type>30</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-.svn</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
@@ -1,12 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sap.sailing.racecommittee.app"
android:versionCode="63"
android:versionName="1.4.63">
package="com.sap.sailing.racecommittee.app">
<uses-sdk />
@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.sap.sailing.racecommittee.app/tests-jvm/src/com/sap/sailing/racecommittee/app/domain/impl/SimpleRaceIdentifierEscapingTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;com.android.ide.eclipse.adt.ANDROID_FRAMEWORK&quot; javaProject=&quot;com.sap.sailing.racecommittee.app&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.sap.sailing.racecommittee.app&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.sap.sailing.racecommittee.app.domain.impl.SimpleRaceIdentifierEscapingTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.racecommittee.app"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea"/>
</launchConfiguration>
@@ -3,9 +3,6 @@ if (!project.hasProperty("xmake")) {
apply plugin: "com.getkeepsafe.dexcount"
}
def packageName="com.sap.sailing.racecommittee.app"
def verCode=1
android {
buildToolsVersion rootProject.ext.buildTools
compileSdkVersion rootProject.ext.compileSdk
@@ -23,35 +20,22 @@ android {
outputFileName = new File(outputFileName.replace("-$variant.buildType.name", ""))
}
variant.assemble.doLast { assemble ->
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, "$packageName" + ".version")
versionFile.text = "$packageName" + ".apk=$verCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
}
def versionPropertiesFile = file('project.properties')
if (versionPropertiesFile.exists()) {
def versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropertiesFile))
verCode = (versionProps['VERSION_CODE'] ?: '0').toInteger()
def runTasks = gradle.startParameter.taskNames
if ('assemble' in runTasks || 'assembleRelease' in runTasks || 'aR' in runTasks) {
verCode = verCode + 1
// Create version file
def versionFile = new File(rootProject.ext.destinationFolder, "$packageName" + ".version")
versionFile.text = "$packageName" + ".apk=$appVersionCode-$variant.buildType.name"
copy {
from variant.outputs*.outputFile
into rootProject.ext.destinationFolder
}
}
versionProps['VERSION_CODE'] = verCode.toString()
versionProps.store(versionPropertiesFile.newWriter(), null)
}
defaultConfig {
applicationId packageName
minSdkVersion rootProject.ext.minSdk
targetSdkVersion rootProject.ext.targetSdk
versionCode verCode
versionName "$verCode - Laser"
versionCode appVersionCode.toInteger()
versionName "$appVersionCode - Laser"
}
sourceSets {
@@ -100,8 +84,6 @@ android {
packagingOptions {
exclude "LICENSE.txt"
exclude ".readme"
exclude "pom.properties"
exclude "pom.xml"
}
}
@@ -0,0 +1,3 @@
packageName=com.sap.sailing.racecommittee.app
appVersionCode=63
appVersionName=1.4.63
@@ -1,203 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.sap.sailing</groupId>
<artifactId>mobile</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.sap.sailing</groupId>
<artifactId>com.sap.sailing.racecommittee.app</artifactId>
<packaging>apk</packaging>
<properties>
<!-- If you change this name, change in RCApp too! -->
<additional-deployment-version-file>com.sap.sailing.racecommittee.app.version</additional-deployment-version-file>
<!-- passed by buildAndUpdateProduct.sh (parsed from AndroidManifest.xml) -->
<app-version>${rc-app-version}</app-version>
</properties>
<dependencies>
<dependency>
<groupId>${android.api.groupId}</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v13</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>com.h6ah4i.android.widget.advrecyclerview</groupId>
<artifactId>advrecyclerview</artifactId>
<version>0.7.4</version>
<type>aar</type>
<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
</exclusion>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>appcompat-v7</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>recyclerview-v7</artifactId>
<type>aar</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.sap.sailing.android.shared</artifactId>
<version>${project.version}</version>
<type>aar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.psdev.licensesdialog</groupId>
<artifactId>licensesdialog</artifactId>
<version>1.8.0</version>
<type>aar</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${project.basedir}/tests-jvm/src</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>non-leandi</id>
<activation>
<property>
<name>!ldi.releaseBuild</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<!-- If not running on Lean DI we do the signing by ourselves with our own keystore. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for copying the *.apk to com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed for creation of *.version files for the *.apk in com.sap.sailing.www project. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<!-- Needed to clean the app in com.sap.sailing.www project. -->
<artifactId>maven-clean-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-no-realsign</id>
<activation>
<property>
<!-- When running on Lean DI but it's not a release build, we do signing on our own. -->
<name>ldi.releaseType</name>
<value>milestone</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>leandi-realsign</id>
<activation>
<property>
<!-- When running on Lean DI and it's a release build, we do SAP signing. -->
<name>ldi.releaseType</name>
<value>customer</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.sap.prd.codesign</groupId>
<artifactId>com.sap.prd.codesign.maven-jarsigner-plugin</artifactId>
</plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin> -->
</plugins>
</build>
</profile>
</profiles>
</project>
@@ -1,11 +1,8 @@
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -1,8 +0,0 @@
#Sun Jan 06 00:30:23 CET 2019
android.library.reference.6=../google-android-support-v13
android.library.reference.5=../licensesdialog_lib/de.psdev.licensesdialog
android.library.reference.4=../github-advrecyclerview_lib
VERSION_CODE=63
android.library.reference.3=../google-android-support-v7-recyclerview_lib
android.library.reference.2=../com.sap.sailing.android.shared
android.library.reference.1=../google-play-services_lib
@@ -1,31 +1,18 @@
package com.sap.sailing.racecommittee.app.ui.fragments.raceinfo;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.sap.sailing.android.shared.logging.ExLog;
import com.sap.sailing.android.shared.util.ViewHelper;
import com.sap.sailing.racecommittee.app.AppConstants;
import com.sap.sailing.racecommittee.app.R;
import com.sap.sailing.racecommittee.app.ui.adapters.PhotoListAdapter;
import com.sap.sailing.racecommittee.app.ui.layouts.HeaderLayout;
import com.sap.sailing.racecommittee.app.ui.views.decoration.PaddingItemDecoration;
import com.sap.sailing.racecommittee.app.utils.CameraHelper;
import com.sap.sailing.racecommittee.app.utils.MailHelper;
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
import com.sap.sailing.racecommittee.app.utils.StringHelper;
import android.Manifest;
import android.app.Activity;
import android.content.ClipData;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@@ -35,9 +22,30 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;
import com.sap.sailing.android.shared.logging.ExLog;
import com.sap.sailing.android.shared.util.ViewHelper;
import com.sap.sailing.racecommittee.app.AppConstants;
import com.sap.sailing.racecommittee.app.BuildConfig;
import com.sap.sailing.racecommittee.app.R;
import com.sap.sailing.racecommittee.app.ui.adapters.PhotoListAdapter;
import com.sap.sailing.racecommittee.app.ui.layouts.HeaderLayout;
import com.sap.sailing.racecommittee.app.ui.views.decoration.PaddingItemDecoration;
import com.sap.sailing.racecommittee.app.utils.CameraHelper;
import com.sap.sailing.racecommittee.app.utils.MailHelper;
import com.sap.sailing.racecommittee.app.utils.RaceHelper;
import com.sap.sailing.racecommittee.app.utils.StringHelper;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class PhotoListFragment extends BaseFragment {
private final static String TAG = PhotoListFragment.class.getName();
private static final int RC_PERMISSION = 2;
private final static int PHOTO_SHOOTING = 9000;
private ArrayList<Uri> mPhotos;
@@ -67,17 +75,11 @@ public class PhotoListFragment extends BaseFragment {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CameraHelper cameraHelper = CameraHelper.on(getActivity());
Uri photoUri = cameraHelper.getOutputMediaFileUri(CameraHelper.MEDIA_TYPE_IMAGE,
cameraHelper.getSubFolder(getRace()));
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
PackageManager manager = getActivity().getPackageManager();
List<ResolveInfo> activities = manager.queryIntentActivities(intent, 0);
if (activities.size() > 0) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
startActivityForResult(intent, PHOTO_SHOOTING);
if (ContextCompat.checkSelfPermission(requireContext(),
Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
dispatchTakePictureIntent();
} else {
Toast.makeText(getActivity(), getString(R.string.no_camera), Toast.LENGTH_LONG).show();
requestPermissions(new String[]{Manifest.permission.CAMERA}, RC_PERMISSION);
}
}
});
@@ -129,6 +131,16 @@ public class PhotoListFragment extends BaseFragment {
refreshPhotoList();
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (requestCode == RC_PERMISSION) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
dispatchTakePictureIntent();
}
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
@@ -148,6 +160,25 @@ public class PhotoListFragment extends BaseFragment {
}
}
private void dispatchTakePictureIntent() {
CameraHelper cameraHelper = CameraHelper.on(getActivity());
Uri photoUri = cameraHelper.getOutputMediaFileUri(CameraHelper.MEDIA_TYPE_IMAGE,
cameraHelper.getSubFolder(getRace()));
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
PackageManager manager = getActivity().getPackageManager();
List<ResolveInfo> activities = manager.queryIntentActivities(intent, 0);
if (activities.size() > 0) {
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP) {
intent.setClipData(ClipData.newRawUri("", photoUri));
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
startActivityForResult(intent, PHOTO_SHOOTING);
} else {
Toast.makeText(getActivity(), getString(R.string.no_camera), Toast.LENGTH_LONG).show();
}
}
private void refreshPhotoList() {
mPhotos.clear();
CameraHelper cameraHelper = CameraHelper.on(getActivity());
@@ -178,7 +209,9 @@ public class PhotoListFragment extends BaseFragment {
for (File file : files) {
if (file.getName().endsWith(CameraHelper.MEDIA_TYPE_IMAGE_EXT)
|| file.getName().endsWith(CameraHelper.MEDIA_TYPE_VIDEO_EXT)) {
retValue.add(Uri.fromFile(file));
String authority = BuildConfig.APPLICATION_ID + ".fileprovider";
Uri contentUri = FileProvider.getUriForFile(requireContext(), authority, file);
retValue.add(contentUri);
}
}
Collections.sort(retValue, new Comparator<Uri>() {
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/google-android-support-v4"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1 +0,0 @@
/bin/
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>google-android-support-v13</name>
<comment></comment>
<projects>
</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>
@@ -1,101 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v13" >
<uses-sdk android:minSdkVersion="13" />
<application />
</manifest>
@@ -1,15 +0,0 @@
# 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 edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-22
android.library=true
Whitespace-only changes.
@@ -1,2 +0,0 @@
Manifest-Version: 1.0
@@ -1,78 +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.
*/
package android.support.v13.app;
import android.app.Fragment;
/**
* Helper for accessing features in {@link Fragment} introduced after
* API level 13 in a backwards compatible fashion.
*/
public class FragmentCompat {
interface FragmentCompatImpl {
void setMenuVisibility(Fragment f, boolean visible);
void setUserVisibleHint(Fragment f, boolean deferStart);
}
static class BaseFragmentCompatImpl implements FragmentCompatImpl {
public void setMenuVisibility(Fragment f, boolean visible) {
}
public void setUserVisibleHint(Fragment f, boolean deferStart) {
}
}
static class ICSFragmentCompatImpl extends BaseFragmentCompatImpl {
@Override
public void setMenuVisibility(Fragment f, boolean visible) {
FragmentCompatICS.setMenuVisibility(f, visible);
}
}
static class ICSMR1FragmentCompatImpl extends ICSFragmentCompatImpl {
@Override
public void setUserVisibleHint(Fragment f, boolean deferStart) {
FragmentCompatICSMR1.setUserVisibleHint(f, deferStart);
}
}
static final FragmentCompatImpl IMPL;
static {
if (android.os.Build.VERSION.SDK_INT >= 15) {
IMPL = new ICSMR1FragmentCompatImpl();
} else if (android.os.Build.VERSION.SDK_INT >= 14) {
IMPL = new ICSFragmentCompatImpl();
} else {
IMPL = new BaseFragmentCompatImpl();
}
}
/**
* Call {@link Fragment#setMenuVisibility(boolean) Fragment.setMenuVisibility(boolean)}
* if running on an appropriate version of the platform.
*/
public static void setMenuVisibility(Fragment f, boolean visible) {
IMPL.setMenuVisibility(f, visible);
}
/**
* Call {@link Fragment#setUserVisibleHint(boolean) setUserVisibleHint(boolean)}
* if running on an appropriate version of the platform.
*/
public static void setUserVisibleHint(Fragment f, boolean deferStart) {
IMPL.setUserVisibleHint(f, deferStart);
}
}
@@ -1,25 +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.
*/
package android.support.v13.app;
import android.app.Fragment;
class FragmentCompatICS {
public static void setMenuVisibility(Fragment f, boolean visible) {
f.setMenuVisibility(visible);
}
}
@@ -1,25 +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.
*/
package android.support.v13.app;
import android.app.Fragment;
class FragmentCompatICSMR1 {
public static void setUserVisibleHint(Fragment f, boolean isVisible) {
f.setUserVisibleHint(isVisible);
}
}
@@ -1,179 +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.
*/
package android.support.v13.app;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Parcelable;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
/**
* Implementation of {@link android.support.v4.view.PagerAdapter} that
* represents each page as a {@link android.app.Fragment} that is persistently
* kept in the fragment manager as long as the user can return to the page.
*
* <p>This version of the pager is best for use when there are a handful of
* typically more static fragments to be paged through, such as a set of tabs.
* The fragment of each page the user visits will be kept in memory, though its
* view hierarchy may be destroyed when not visible. This can result in using
* a significant amount of memory since fragment instances can hold on to an
* arbitrary amount of state. For larger sets of pages, consider
* {@link FragmentStatePagerAdapter}.
*
* <p>When using FragmentPagerAdapter the host ViewPager must have a
* valid ID set.</p>
*
* <p>Subclasses only need to implement {@link #getItem(int)}
* and {@link #getCount()} to have a working adapter.
*
* <p>Here is an example implementation of a pager containing fragments of
* lists:
*
* {@sample development/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java
* complete}
*
* <p>The <code>R.layout.fragment_pager</code> resource of the top-level fragment is:
*
* {@sample development/samples/Support13Demos/res/layout/fragment_pager.xml
* complete}
*
* <p>The <code>R.layout.fragment_pager_list</code> resource containing each
* individual fragment's layout is:
*
* {@sample development/samples/Support13Demos/res/layout/fragment_pager_list.xml
* complete}
*/
public abstract class FragmentPagerAdapter extends PagerAdapter {
private static final String TAG = "FragmentPagerAdapter";
private static final boolean DEBUG = false;
private final FragmentManager mFragmentManager;
private FragmentTransaction mCurTransaction = null;
private Fragment mCurrentPrimaryItem = null;
public FragmentPagerAdapter(FragmentManager fm) {
mFragmentManager = fm;
}
/**
* Return the Fragment associated with a specified position.
*/
public abstract Fragment getItem(int position);
@Override
public void startUpdate(ViewGroup container) {
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
final long itemId = getItemId(position);
// Do we already have this fragment?
String name = makeFragmentName(container.getId(), itemId);
Fragment fragment = mFragmentManager.findFragmentByTag(name);
if (fragment != null) {
if (DEBUG) Log.v(TAG, "Attaching item #" + itemId + ": f=" + fragment);
mCurTransaction.attach(fragment);
} else {
fragment = getItem(position);
if (DEBUG) Log.v(TAG, "Adding item #" + itemId + ": f=" + fragment);
mCurTransaction.add(container.getId(), fragment,
makeFragmentName(container.getId(), itemId));
}
if (fragment != mCurrentPrimaryItem) {
FragmentCompat.setMenuVisibility(fragment, false);
FragmentCompat.setUserVisibleHint(fragment, false);
}
return fragment;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
if (DEBUG) Log.v(TAG, "Detaching item #" + getItemId(position) + ": f=" + object
+ " v=" + ((Fragment)object).getView());
mCurTransaction.detach((Fragment)object);
}
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment)object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
FragmentCompat.setMenuVisibility(mCurrentPrimaryItem, false);
FragmentCompat.setUserVisibleHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
FragmentCompat.setMenuVisibility(fragment, true);
FragmentCompat.setUserVisibleHint(fragment, true);
}
mCurrentPrimaryItem = fragment;
}
}
@Override
public void finishUpdate(ViewGroup container) {
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
mCurTransaction = null;
mFragmentManager.executePendingTransactions();
}
}
@Override
public boolean isViewFromObject(View view, Object object) {
return ((Fragment)object).getView() == view;
}
@Override
public Parcelable saveState() {
return null;
}
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
}
/**
* Return a unique identifier for the item at the given position.
*
* <p>The default implementation returns the given position.
* Subclasses should override this method if the positions of items can change.</p>
*
* @param position Position within this adapter
* @return Unique identifier for the item at position
*/
public long getItemId(int position) {
return position;
}
private static String makeFragmentName(int viewId, long id) {
return "android:switcher:" + viewId + ":" + id;
}
}
@@ -1,229 +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.
*/
package android.support.v13.app;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
* Implementation of {@link android.support.v4.view.PagerAdapter} that
* uses a {@link Fragment} to manage each page. This class also handles
* saving and restoring of fragment's state.
*
* <p>This version of the pager is more useful when there are a large number
* of pages, working more like a list view. When pages are not visible to
* the user, their entire fragment may be destroyed, only keeping the saved
* state of that fragment. This allows the pager to hold on to much less
* memory associated with each visited page as compared to
* {@link FragmentPagerAdapter} at the cost of potentially more overhead when
* switching between pages.
*
* <p>When using FragmentPagerAdapter the host ViewPager must have a
* valid ID set.</p>
*
* <p>Subclasses only need to implement {@link #getItem(int)}
* and {@link #getCount()} to have a working adapter.
*
* <p>Here is an example implementation of a pager containing fragments of
* lists:
*
* {@sample development/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentStatePagerSupport.java
* complete}
*
* <p>The <code>R.layout.fragment_pager</code> resource of the top-level fragment is:
*
* {@sample development/samples/Support4Demos/res/layout/fragment_pager.xml
* complete}
*
* <p>The <code>R.layout.fragment_pager_list</code> resource containing each
* individual fragment's layout is:
*
* {@sample development/samples/Support4Demos/res/layout/fragment_pager_list.xml
* complete}
*/
public abstract class FragmentStatePagerAdapter extends PagerAdapter {
private static final String TAG = "FragmentStatePagerAdapter";
private static final boolean DEBUG = false;
private final FragmentManager mFragmentManager;
private FragmentTransaction mCurTransaction = null;
private ArrayList<Fragment.SavedState> mSavedState = new ArrayList<Fragment.SavedState>();
private ArrayList<Fragment> mFragments = new ArrayList<Fragment>();
private Fragment mCurrentPrimaryItem = null;
public FragmentStatePagerAdapter(FragmentManager fm) {
mFragmentManager = fm;
}
/**
* Return the Fragment associated with a specified position.
*/
public abstract Fragment getItem(int position);
@Override
public void startUpdate(ViewGroup container) {
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// If we already have this item instantiated, there is nothing
// to do. This can happen when we are restoring the entire pager
// from its saved state, where the fragment manager has already
// taken care of restoring the fragments we previously had instantiated.
if (mFragments.size() > position) {
Fragment f = mFragments.get(position);
if (f != null) {
return f;
}
}
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
Fragment fragment = getItem(position);
if (DEBUG) Log.v(TAG, "Adding item #" + position + ": f=" + fragment);
if (mSavedState.size() > position) {
Fragment.SavedState fss = mSavedState.get(position);
if (fss != null) {
fragment.setInitialSavedState(fss);
}
}
while (mFragments.size() <= position) {
mFragments.add(null);
}
FragmentCompat.setMenuVisibility(fragment, false);
FragmentCompat.setUserVisibleHint(fragment, false);
mFragments.set(position, fragment);
mCurTransaction.add(container.getId(), fragment);
return fragment;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment)object;
if (mCurTransaction == null) {
mCurTransaction = mFragmentManager.beginTransaction();
}
if (DEBUG) Log.v(TAG, "Removing item #" + position + ": f=" + object
+ " v=" + ((Fragment)object).getView());
while (mSavedState.size() <= position) {
mSavedState.add(null);
}
mSavedState.set(position, mFragmentManager.saveFragmentInstanceState(fragment));
mFragments.set(position, null);
mCurTransaction.remove(fragment);
}
@Override
public void setPrimaryItem(ViewGroup container, int position, Object object) {
Fragment fragment = (Fragment)object;
if (fragment != mCurrentPrimaryItem) {
if (mCurrentPrimaryItem != null) {
FragmentCompat.setMenuVisibility(mCurrentPrimaryItem, false);
FragmentCompat.setUserVisibleHint(mCurrentPrimaryItem, false);
}
if (fragment != null) {
FragmentCompat.setMenuVisibility(fragment, true);
FragmentCompat.setUserVisibleHint(fragment, true);
}
mCurrentPrimaryItem = fragment;
}
}
@Override
public void finishUpdate(ViewGroup container) {
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
mCurTransaction = null;
mFragmentManager.executePendingTransactions();
}
}
@Override
public boolean isViewFromObject(View view, Object object) {
return ((Fragment)object).getView() == view;
}
@Override
public Parcelable saveState() {
Bundle state = null;
if (mSavedState.size() > 0) {
state = new Bundle();
Fragment.SavedState[] fss = new Fragment.SavedState[mSavedState.size()];
mSavedState.toArray(fss);
state.putParcelableArray("states", fss);
}
for (int i=0; i<mFragments.size(); i++) {
Fragment f = mFragments.get(i);
if (f != null && f.isAdded()) {
if (state == null) {
state = new Bundle();
}
String key = "f" + i;
mFragmentManager.putFragment(state, key, f);
}
}
return state;
}
@Override
public void restoreState(Parcelable state, ClassLoader loader) {
if (state != null) {
Bundle bundle = (Bundle)state;
bundle.setClassLoader(loader);
Parcelable[] fss = bundle.getParcelableArray("states");
mSavedState.clear();
mFragments.clear();
if (fss != null) {
for (int i=0; i<fss.length; i++) {
mSavedState.add((Fragment.SavedState)fss[i]);
}
}
Iterable<String> keys = bundle.keySet();
for (String key: keys) {
if (key.startsWith("f")) {
int index = Integer.parseInt(key.substring(1));
Fragment f = mFragmentManager.getFragment(bundle, key);
if (f != null) {
while (mFragments.size() <= index) {
mFragments.add(null);
}
FragmentCompat.setMenuVisibility(f, false);
mFragments.set(index, f);
} else {
Log.w(TAG, "Bad fragment at key " + key);
}
}
}
}
}
}
@@ -1,347 +0,0 @@
/*
* Copyright (C) 2012 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 android.support.v13.app;
import java.util.ArrayList;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TabHost;
import android.widget.TabWidget;
/**
* Version of {@link android.support.v4.app.FragmentTabHost} that can be
* used with the platform {@link android.app.Fragment} APIs. You will not
* normally use this, instead using action bar tabs.
*/
public class FragmentTabHost extends TabHost
implements TabHost.OnTabChangeListener {
private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>();
private FrameLayout mRealTabContent;
private Context mContext;
private FragmentManager mFragmentManager;
private int mContainerId;
private TabHost.OnTabChangeListener mOnTabChangeListener;
private TabInfo mLastTab;
private boolean mAttached;
static final class TabInfo {
private final String tag;
private final Class<?> clss;
private final Bundle args;
private Fragment fragment;
TabInfo(String _tag, Class<?> _class, Bundle _args) {
tag = _tag;
clss = _class;
args = _args;
}
}
static class DummyTabFactory implements TabHost.TabContentFactory {
private final Context mContext;
public DummyTabFactory(Context context) {
mContext = context;
}
@Override
public View createTabContent(String tag) {
View v = new View(mContext);
v.setMinimumWidth(0);
v.setMinimumHeight(0);
return v;
}
}
static class SavedState extends BaseSavedState {
String curTab;
SavedState(Parcelable superState) {
super(superState);
}
private SavedState(Parcel in) {
super(in);
curTab = in.readString();
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeString(curTab);
}
@Override
public String toString() {
return "FragmentTabHost.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " curTab=" + curTab + "}";
}
public static final Parcelable.Creator<SavedState> CREATOR
= new Parcelable.Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
public FragmentTabHost(Context context) {
// Note that we call through to the version that takes an AttributeSet,
// because the simple Context construct can result in a broken object!
super(context, null);
initFragmentTabHost(context, null);
}
public FragmentTabHost(Context context, AttributeSet attrs) {
super(context, attrs);
initFragmentTabHost(context, attrs);
}
private void initFragmentTabHost(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs,
new int[] { android.R.attr.inflatedId }, 0, 0);
mContainerId = a.getResourceId(0, 0);
a.recycle();
super.setOnTabChangedListener(this);
}
private void ensureHierarchy(Context context) {
// If owner hasn't made its own view hierarchy, then as a convenience
// we will construct a standard one here.
if (findViewById(android.R.id.tabs) == null) {
LinearLayout ll = new LinearLayout(context);
ll.setOrientation(LinearLayout.VERTICAL);
addView(ll, new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
TabWidget tw = new TabWidget(context);
tw.setId(android.R.id.tabs);
tw.setOrientation(TabWidget.HORIZONTAL);
ll.addView(tw, new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT, 0));
FrameLayout fl = new FrameLayout(context);
fl.setId(android.R.id.tabcontent);
ll.addView(fl, new LinearLayout.LayoutParams(0, 0, 0));
mRealTabContent = fl = new FrameLayout(context);
mRealTabContent.setId(mContainerId);
ll.addView(fl, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT, 0, 1));
}
}
/**
* @deprecated Don't call the original TabHost setup, you must instead
* call {@link #setup(Context, FragmentManager)} or
* {@link #setup(Context, FragmentManager, int)}.
*/
@Override @Deprecated
public void setup() {
throw new IllegalStateException(
"Must call setup() that takes a Context and FragmentManager");
}
public void setup(Context context, FragmentManager manager) {
ensureHierarchy(context); // Ensure views required by super.setup()
super.setup();
mContext = context;
mFragmentManager = manager;
ensureContent();
}
public void setup(Context context, FragmentManager manager, int containerId) {
ensureHierarchy(context); // Ensure views required by super.setup()
super.setup();
mContext = context;
mFragmentManager = manager;
mContainerId = containerId;
ensureContent();
mRealTabContent.setId(containerId);
// We must have an ID to be able to save/restore our state. If
// the owner hasn't set one at this point, we will set it ourself.
if (getId() == View.NO_ID) {
setId(android.R.id.tabhost);
}
}
private void ensureContent() {
if (mRealTabContent == null) {
mRealTabContent = (FrameLayout)findViewById(mContainerId);
if (mRealTabContent == null) {
throw new IllegalStateException(
"No tab content FrameLayout found for id " + mContainerId);
}
}
}
@Override
public void setOnTabChangedListener(OnTabChangeListener l) {
mOnTabChangeListener = l;
}
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
tabSpec.setContent(new DummyTabFactory(mContext));
String tag = tabSpec.getTag();
TabInfo info = new TabInfo(tag, clss, args);
if (mAttached) {
// If we are already attached to the window, then check to make
// sure this tab's fragment is inactive if it exists. This shouldn't
// normally happen.
info.fragment = mFragmentManager.findFragmentByTag(tag);
if (info.fragment != null && !info.fragment.isDetached()) {
FragmentTransaction ft = mFragmentManager.beginTransaction();
ft.detach(info.fragment);
ft.commit();
}
}
mTabs.add(info);
addTab(tabSpec);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
String currentTab = getCurrentTabTag();
// Go through all tabs and make sure their fragments match
// the correct state.
FragmentTransaction ft = null;
for (int i=0; i<mTabs.size(); i++) {
TabInfo tab = mTabs.get(i);
tab.fragment = mFragmentManager.findFragmentByTag(tab.tag);
if (tab.fragment != null && !tab.fragment.isDetached()) {
if (tab.tag.equals(currentTab)) {
// The fragment for this tab is already there and
// active, and it is what we really want to have
// as the current tab. Nothing to do.
mLastTab = tab;
} else {
// This fragment was restored in the active state,
// but is not the current tab. Deactivate it.
if (ft == null) {
ft = mFragmentManager.beginTransaction();
}
ft.detach(tab.fragment);
}
}
}
// We are now ready to go. Make sure we are switched to the
// correct tab.
mAttached = true;
ft = doTabChanged(currentTab, ft);
if (ft != null) {
ft.commit();
mFragmentManager.executePendingTransactions();
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mAttached = false;
}
@Override
protected Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
SavedState ss = new SavedState(superState);
ss.curTab = getCurrentTabTag();
return ss;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
SavedState ss = (SavedState)state;
super.onRestoreInstanceState(ss.getSuperState());
setCurrentTabByTag(ss.curTab);
}
@Override
public void onTabChanged(String tabId) {
if (mAttached) {
FragmentTransaction ft = doTabChanged(tabId, null);
if (ft != null) {
ft.commit();
}
}
if (mOnTabChangeListener != null) {
mOnTabChangeListener.onTabChanged(tabId);
}
}
private FragmentTransaction doTabChanged(String tabId, FragmentTransaction ft) {
TabInfo newTab = null;
for (int i=0; i<mTabs.size(); i++) {
TabInfo tab = mTabs.get(i);
if (tab.tag.equals(tabId)) {
newTab = tab;
}
}
if (newTab == null) {
throw new IllegalStateException("No tab known for tag " + tabId);
}
if (mLastTab != newTab) {
if (ft == null) {
ft = mFragmentManager.beginTransaction();
}
if (mLastTab != null) {
if (mLastTab.fragment != null) {
ft.detach(mLastTab.fragment);
}
}
if (newTab != null) {
if (newTab.fragment == null) {
newTab.fragment = Fragment.instantiate(mContext,
newTab.clss.getName(), newTab.args);
ft.add(mContainerId, newTab.fragment, newTab.tag);
} else {
ft.attach(newTab.fragment);
}
}
mLastTab = newTab;
}
return ft;
}
}
@@ -1,5 +0,0 @@
<body>
Support classes to access some of the android.app package features introduced after API level 13 in a backwards compatible fashion.
</body>
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="var" path="ANDROID_HOME/extras/android/m2repository/com/android/support/support-annotations/22.2.1/support-annotations-22.2.1.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
@@ -1 +0,0 @@
/bin/
-33
View File
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>google-android-support-v4</name>
<comment></comment>
<projects>
</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>
@@ -1,101 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=ignore
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=ignore
org.eclipse.jdt.core.compiler.source=1.7
@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.v4" >
<uses-sdk android:minSdkVersion="4" />
<application />
</manifest>
@@ -1,18 +0,0 @@
/* Copyright 2014, 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 android.support.v4.media;
parcelable MediaMetadataCompat;
@@ -1,18 +0,0 @@
/* Copyright 2014, 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 android.support.v4.media;
parcelable RatingCompat;
@@ -1,20 +0,0 @@
/* Copyright 2014, 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 android.support.v4.media.session;
parcelable MediaSessionCompat.Token;
parcelable MediaSessionCompat.QueueItem;
parcelable MediaSessionCompat.ResultReceiverWrapper;
@@ -1,18 +0,0 @@
/* Copyright 2014, 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 android.support.v4.media.session;
parcelable ParcelableVolumeInfo;
@@ -1,18 +0,0 @@
/* Copyright 2014, 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 android.support.v4.media.session;
parcelable PlaybackStateCompat;
@@ -1,15 +0,0 @@
# 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 edit
# "ant.properties", and override values to adapt the script to your
# project structure.
#
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-22
android.library=true
Whitespace-only changes.
@@ -1,2 +0,0 @@
Manifest-Version: 1.0
@@ -1,451 +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.
*/
package android.support.v4.accessibilityservice;
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.view.View;
/**
* Helper for accessing features in {@link android.accessibilityservice.AccessibilityService}
* introduced after API level 4 in a backwards compatible fashion.
*/
public class AccessibilityServiceInfoCompat {
static interface AccessibilityServiceInfoVersionImpl {
public String getId(AccessibilityServiceInfo info);
public ResolveInfo getResolveInfo(AccessibilityServiceInfo info);
public boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info);
public String getDescription(AccessibilityServiceInfo info);
public String getSettingsActivityName(AccessibilityServiceInfo info);
public int getCapabilities(AccessibilityServiceInfo info);
}
static class AccessibilityServiceInfoStubImpl implements AccessibilityServiceInfoVersionImpl {
public boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) {
return false;
}
public String getDescription(AccessibilityServiceInfo info) {
return null;
}
public String getId(AccessibilityServiceInfo info) {
return null;
}
public ResolveInfo getResolveInfo(AccessibilityServiceInfo info) {
return null;
}
public String getSettingsActivityName(AccessibilityServiceInfo info) {
return null;
}
public int getCapabilities(AccessibilityServiceInfo info) {
return 0;
}
}
static class AccessibilityServiceInfoIcsImpl extends AccessibilityServiceInfoStubImpl {
@Override
public boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatIcs.getCanRetrieveWindowContent(info);
}
@Override
public String getDescription(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatIcs.getDescription(info);
}
@Override
public String getId(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatIcs.getId(info);
}
@Override
public ResolveInfo getResolveInfo(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatIcs.getResolveInfo(info);
}
@Override
public String getSettingsActivityName(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatIcs.getSettingsActivityName(info);
}
@Override
public int getCapabilities(AccessibilityServiceInfo info) {
if (getCanRetrieveWindowContent(info)) {
return CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT;
}
return 0;
}
}
static class AccessibilityServiceInfoJellyBeanMr2 extends AccessibilityServiceInfoIcsImpl {
@Override
public int getCapabilities(AccessibilityServiceInfo info) {
return AccessibilityServiceInfoCompatJellyBeanMr2.getCapabilities(info);
}
}
static {
if (Build.VERSION.SDK_INT >= 18) { // JellyBean MR2
IMPL = new AccessibilityServiceInfoJellyBeanMr2();
} else if (Build.VERSION.SDK_INT >= 14) { // ICS
IMPL = new AccessibilityServiceInfoIcsImpl();
} else {
IMPL = new AccessibilityServiceInfoStubImpl();
}
}
// Capabilities
private static final AccessibilityServiceInfoVersionImpl IMPL;
/**
* Capability: This accessibility service can retrieve the active window content.
*/
public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 0x00000001;
/**
* Capability: This accessibility service can request touch exploration mode in which
* touched items are spoken aloud and the UI can be explored via gestures.
*/
public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 0x00000002;
/**
* Capability: This accessibility service can request enhanced web accessibility
* enhancements. For example, installing scripts to make app content more accessible.
*/
public static final int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 0x00000004;
/**
* Capability: This accessibility service can filter the key event stream.
*/
public static final int CAPABILITY_CAN_FILTER_KEY_EVENTS = 0x00000008;
// Feedback types
/**
* Denotes braille feedback.
*/
public static final int FEEDBACK_BRAILLE = 0x0000020;
/**
* Mask for all feedback types.
*
* @see AccessibilityServiceInfo#FEEDBACK_SPOKEN
* @see AccessibilityServiceInfo#FEEDBACK_HAPTIC
* @see AccessibilityServiceInfo#FEEDBACK_AUDIBLE
* @see AccessibilityServiceInfo#FEEDBACK_VISUAL
* @see AccessibilityServiceInfo#FEEDBACK_GENERIC
* @see FEEDBACK_BRAILLE
*/
public static final int FEEDBACK_ALL_MASK = 0xFFFFFFFF;
// Flags
/**
* If an {@link AccessibilityService} is the default for a given type.
* Default service is invoked only if no package specific one exists. In case of
* more than one package specific service only the earlier registered is notified.
*/
public static final int DEFAULT = 0x0000001;
/**
* If this flag is set the system will regard views that are not important
* for accessibility in addition to the ones that are important for accessibility.
* That is, views that are marked as not important for accessibility via
* {@link View#IMPORTANT_FOR_ACCESSIBILITY_NO} or
* {@link View#IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS} and views that are
* marked as potentially important for accessibility via
* {@link View#IMPORTANT_FOR_ACCESSIBILITY_AUTO} for which the system has determined
* that are not important for accessibility, are both reported while querying the
* window content and also the accessibility service will receive accessibility events
* from them.
* <p>
* <strong>Note:</strong> For accessibility services targeting API version
* {@link Build.VERSION_CODES#JELLY_BEAN} or higher this flag has to be explicitly
* set for the system to regard views that are not important for accessibility. For
* accessibility services targeting API version lower than
* {@link Build.VERSION_CODES#JELLY_BEAN} this flag is ignored and all views are
* regarded for accessibility purposes.
* </p>
* <p>
* Usually views not important for accessibility are layout managers that do not
* react to user actions, do not draw any content, and do not have any special
* semantics in the context of the screen content. For example, a three by three
* grid can be implemented as three horizontal linear layouts and one vertical,
* or three vertical linear layouts and one horizontal, or one grid layout, etc.
* In this context the actual layout mangers used to achieve the grid configuration
* are not important, rather it is important that there are nine evenly distributed
* elements.
* </p>
*/
public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 0x0000002;
/**
* This flag requests that the system gets into touch exploration mode.
* In this mode a single finger moving on the screen behaves as a mouse
* pointer hovering over the user interface. The system will also detect
* certain gestures performed on the touch screen and notify this service.
* The system will enable touch exploration mode if there is at least one
* accessibility service that has this flag set. Hence, clearing this
* flag does not guarantee that the device will not be in touch exploration
* mode since there may be another enabled service that requested it.
* <p>
* For accessibility services targeting API version higher than
* {@link Build.VERSION_CODES#JELLY_BEAN_MR1} that want to set
* this flag have to declare this capability in their meta-data by setting
* the attribute canRequestTouchExplorationMode to true, otherwise this flag
* will be ignored. For how to declare the meta-data of a service refer to
* {@value AccessibilityService#SERVICE_META_DATA}.
* </p>
* <p>
* Services targeting API version equal to or lower than
* {@link Build.VERSION_CODES#JELLY_BEAN_MR1} will work normally, i.e.
* the first time they are run, if this flag is specified, a dialog is
* shown to the user to confirm enabling explore by touch.
* </p>
*/
public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 0x0000004;
/**
* This flag requests from the system to enable web accessibility enhancing
* extensions. Such extensions aim to provide improved accessibility support
* for content presented in a {@link android.webkit.WebView}. An example of such
* an extension is injecting JavaScript from a secure source. The system will enable
* enhanced web accessibility if there is at least one accessibility service
* that has this flag set. Hence, clearing this flag does not guarantee that the
* device will not have enhanced web accessibility enabled since there may be
* another enabled service that requested it.
* <p>
* Services that want to set this flag have to declare this capability
* in their meta-data by setting the attribute canRequestEnhancedWebAccessibility
* to true, otherwise this flag will be ignored. For how to declare the meta-data
* of a service refer to {@value AccessibilityService#SERVICE_META_DATA}.
* </p>
*/
public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 0x00000008;
/**
* This flag requests that the AccessibilityNodeInfos obtained
* by an {@link AccessibilityService} contain the id of the source view.
* The source view id will be a fully qualified resource name of the
* form "package:id/name", for example "foo.bar:id/my_list", and it is
* useful for UI test automation. This flag is not set by default.
*/
public static final int FLAG_REPORT_VIEW_IDS = 0x00000010;
/**
* This flag requests from the system to filter key events. If this flag
* is set the accessibility service will receive the key events before
* applications allowing it implement global shortcuts. Setting this flag
* does not guarantee that this service will filter key events since only
* one service can do so at any given time. This avoids user confusion due
* to behavior change in case different key filtering services are enabled.
* If there is already another key filtering service enabled, this one will
* not receive key events.
* <p>
* Services that want to set this flag have to declare this capability
* in their meta-data by setting the attribute canRequestFilterKeyEvents
* to true, otherwise this flag will be ignored. For how to declare the meta
* -data of a service refer to {@value AccessibilityService#SERVICE_META_DATA}.
* </p>
*/
public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 0x00000020;
/*
* Hide constructor
*/
private AccessibilityServiceInfoCompat() {
}
/**
* The accessibility service id.
* <p>
* <strong>Generated by the system.</strong>
* </p>
*
* @return The id.
*/
public static String getId(AccessibilityServiceInfo info) {
return IMPL.getId(info);
}
/**
* The service {@link ResolveInfo}.
* <p>
* <strong>Generated by the system.</strong>
* </p>
*
* @return The info.
*/
public static ResolveInfo getResolveInfo(AccessibilityServiceInfo info) {
return IMPL.getResolveInfo(info);
}
/**
* The settings activity name.
* <p>
* <strong>Statically set from {@link AccessibilityService#SERVICE_META_DATA
* meta-data}.</strong>
* </p>
*
* @return The settings activity name.
*/
public static String getSettingsActivityName(AccessibilityServiceInfo info) {
return IMPL.getSettingsActivityName(info);
}
/**
* Whether this service can retrieve the current window's content.
* <p>
* <strong>Statically set from {@link AccessibilityService#SERVICE_META_DATA
* meta-data}.</strong>
* </p>
*
* @return True window content can be retrieved.
*/
public static boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) {
return IMPL.getCanRetrieveWindowContent(info);
}
/**
* Description of the accessibility service.
* <p>
* <strong>Statically set from {@link AccessibilityService#SERVICE_META_DATA
* meta-data}.</strong>
* </p>
*
* @return The description.
*/
public static String getDescription(AccessibilityServiceInfo info) {
return IMPL.getDescription(info);
}
/**
* Returns the string representation of a feedback type. For example,
* {@link AccessibilityServiceInfo#FEEDBACK_SPOKEN} is represented by the
* string FEEDBACK_SPOKEN.
*
* @param feedbackType The feedback type.
* @return The string representation.
*/
public static String feedbackTypeToString(int feedbackType) {
StringBuilder builder = new StringBuilder();
builder.append("[");
while (feedbackType > 0) {
final int feedbackTypeFlag = 1 << Integer.numberOfTrailingZeros(feedbackType);
feedbackType &= ~feedbackTypeFlag;
if (builder.length() > 1) {
builder.append(", ");
}
switch (feedbackTypeFlag) {
case AccessibilityServiceInfo.FEEDBACK_AUDIBLE:
builder.append("FEEDBACK_AUDIBLE");
break;
case AccessibilityServiceInfo.FEEDBACK_HAPTIC:
builder.append("FEEDBACK_HAPTIC");
break;
case AccessibilityServiceInfo.FEEDBACK_GENERIC:
builder.append("FEEDBACK_GENERIC");
break;
case AccessibilityServiceInfo.FEEDBACK_SPOKEN:
builder.append("FEEDBACK_SPOKEN");
break;
case AccessibilityServiceInfo.FEEDBACK_VISUAL:
builder.append("FEEDBACK_VISUAL");
break;
}
}
builder.append("]");
return builder.toString();
}
/**
* Returns the string representation of a flag. For example,
* {@link AccessibilityServiceInfo#DEFAULT} is represented by the
* string DEFAULT.
*
* @param flag The flag.
* @return The string representation.
*/
public static String flagToString(int flag) {
switch (flag) {
case DEFAULT:
return "DEFAULT";
case FLAG_INCLUDE_NOT_IMPORTANT_VIEWS:
return "FLAG_INCLUDE_NOT_IMPORTANT_VIEWS";
case FLAG_REQUEST_TOUCH_EXPLORATION_MODE:
return "FLAG_REQUEST_TOUCH_EXPLORATION_MODE";
case FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY:
return "FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY";
case FLAG_REPORT_VIEW_IDS:
return "FLAG_REPORT_VIEW_IDS";
case FLAG_REQUEST_FILTER_KEY_EVENTS:
return "FLAG_REQUEST_FILTER_KEY_EVENTS";
default:
return null;
}
}
/**
* Returns the bit mask of capabilities this accessibility service has such as
* being able to retrieve the active window content, etc.
*
* @param info The service info whose capabilities to get.
* @return The capability bit mask.
*
* @see #CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT
* @see #CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION
* @see #CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY
* @see #CAPABILITY_CAN_FILTER_KEY_EVENTS
*/
public static int getCapabilities(AccessibilityServiceInfo info) {
return IMPL.getCapabilities(info);
}
/**
* Returns the string representation of a capability. For example,
* {@link #CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT} is represented
* by the string CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT.
*
* @param capability The capability.
* @return The string representation.
*/
public static String capabilityToString(int capability) {
switch (capability) {
case CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT:
return "CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT";
case CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION:
return "CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION";
case CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY:
return "CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY";
case CAPABILITY_CAN_FILTER_KEY_EVENTS:
return "CAPABILITY_CAN_FILTER_KEY_EVENTS";
default:
return "UNKNOWN";
}
}
}
@@ -1,47 +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.
*/
package android.support.v4.accessibilityservice;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ResolveInfo;
/**
* ICS implementation of the new APIs in AccessibilityServiceInfo.
*/
class AccessibilityServiceInfoCompatIcs {
public static boolean getCanRetrieveWindowContent(AccessibilityServiceInfo info) {
return info.getCanRetrieveWindowContent();
}
public static String getDescription(AccessibilityServiceInfo info) {
return info.getDescription();
}
public static String getId(AccessibilityServiceInfo info) {
return info.getId();
}
public static ResolveInfo getResolveInfo(AccessibilityServiceInfo info) {
return info.getResolveInfo();
}
public static String getSettingsActivityName(AccessibilityServiceInfo info) {
return info.getSettingsActivityName();
}
}
@@ -1,30 +0,0 @@
/*
* Copyright (C) 2013 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 android.support.v4.accessibilityservice;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.content.pm.ResolveInfo;
/**
* ICS implementation of the new APIs in AccessibilityServiceInfo.
*/
class AccessibilityServiceInfoCompatJellyBeanMr2 {
public static int getCapabilities(AccessibilityServiceInfo info) {
return info.getCapabilities();
}
}
@@ -1,6 +0,0 @@
<body>
Support android.accessibilityservice classes to assist with development of applications for
android API level 4 or later.
</body>
@@ -1,40 +0,0 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.animation;
import android.os.Build;
abstract public class AnimatorCompatHelper {
static AnimatorProvider IMPL;
static {
if (Build.VERSION.SDK_INT >= 12) {
IMPL = new HoneycombMr1AnimatorCompatProvider();
} else {
IMPL = new DonutAnimatorCompatProvider();
}
}
public static ValueAnimatorCompat emptyValueAnimator() {
return IMPL.emptyValueAnimator();
}
AnimatorCompatHelper() {
}
}
@@ -1,57 +0,0 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.animation;
/**
* <p>An animation listener that receives notifications from an animation.
* Notifications indicate animation related events, such as the end or the
* repetition of the animation.</p>
*
* @hide
*/
public interface AnimatorListenerCompat {
/**
* <p>Notifies the start of the animation.</p>
*
* @param animation The started animation.
*/
void onAnimationStart(ValueAnimatorCompat animation);
/**
* <p>Notifies the end of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE.</p>
*
* @param animation The animation which reached its end.
*/
void onAnimationEnd(ValueAnimatorCompat animation);
/**
* <p>Notifies the cancellation of the animation. This callback is not invoked
* for animations with repeat count set to INFINITE.</p>
*
* @param animation The animation which was canceled.
*/
void onAnimationCancel(ValueAnimatorCompat animation);
/**
* <p>Notifies the repetition of the animation.</p>
*
* @param animation The animation which was repeated.
*/
void onAnimationRepeat(ValueAnimatorCompat animation);
}
@@ -1,35 +0,0 @@
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.animation;
/**
* A simple interface to do things in animation pulse.
* <p>
* Before Honeycomb, it uses a simple Handler to mimic animation callback.
* <p>
* This is only a minimal implementation which is why this class is hidden.
*
* @hide
*/
interface AnimatorProvider {
/**
* Provides a simple ValueAnimator w/o any start or end values. It provides the same
* Animator callback interface.
*/
ValueAnimatorCompat emptyValueAnimator();
}
Loaded 100 of 1228 files, more files were not shown because too many files have changed in this diff. Show more