Monday, August 5, 2013

Week 13: More Android

This week, I continued working on collecting entropy from the mobile Android platform. The first thing I worked on was setting up a TabView to categorize the different sources of entropy within the user interface. I added the already finished BatteryActivity.java Activity to one tab and then moved on to Android system information. I found the class ActivityManager.RunningTaskInfo, which provides information for each task currently running in the environment. This information includes a unique identifier, the base Activity associated with the task, the number of running Activities associated with the task, and the Activity component that is at the top of the history stack. While I am already able to access this data through the Task Activity I wrote, I am still working on creating a Table layout that will display it appropriately in the UI. I plan on making a similar tab for the RunningServiceInfo class and another tab for MemoryInfo.

With the framework for extracting system data set up, I turned my attention to CyanogenMod to see if I could retrieve more fine-grained readings for things like battery voltage and temperature. After a couple days of tinkering, I was able to root the Nexus S test device with CyanogenMod 10.1. Unfortunately, once this new OS had been loaded, I could not get Eclipse to recognize the device so I could not debug my app on it. I will try to find a solution to this problem, although I believe this will not contribute much to the app since it would only improve the data for the battery and not the OS information. My first priority will be finishing up the UI and working on sending the data over a network.

The last thing I worked on was trying to get the location of the device, which I thought may be a useful source of entropy. What I thought would be a relatively simple task actually turned into a considerable challenge. First of all, the LocationManager class gathers location data from several different sources, such as the GPS, the network, or a wifi connection. I used the following code:

locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, true);
if (provider != null){
Log.v(TAG, "Requesting Location updates...");
          locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this.locationListener);
       locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, this.locationListener);
}



to obtain as many location updates as possible from both the GPS and network providers. I quickly found out, however, that GPS does not work indoors and since the phone is not part of a network, I cannot get the location. Even the native Google Maps app shuts down with an error saying the app requires a network provider to work. If Amir thinks it is a good idea to incorporate location data, I will talk to Denis about trying to obtain a monthly plan or alternative options. 

No comments:

Post a Comment