Protect MyTracksProvider based on the MyTracks settings bit.

Move MyTracksProvider to DatabaseProvider and protect the DatabaseProvider
using the AndroidManifest.xml.

Create a MyTracksProviderUtilFactory to create an instance of
MyTracksProviderUtils that accesses the DatabaseProvider.

Recreate MyTracksProvider by extending DatabaseProvider.
The recreated provider checks access, changes the authority,
and invokes the DatabaseProvider methods.
This commit is contained in:
Jimmy Shih
2011-10-07 16:23:59 -07:00
parent 1ffd77595d
commit 9e5204934f
42 changed files with 752 additions and 560 deletions
@@ -15,7 +15,7 @@
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.MyTracksProviderUtils;
import com.google.android.apps.mytracks.content.MyTracksProviderUtilsFactory;
import com.google.android.apps.mytracks.content.Track;
import com.google.android.apps.mytracks.content.TracksColumns;
import com.google.android.maps.mytracks.R;
@@ -89,7 +89,7 @@ public class TrackDetails extends Activity implements OnClickListener {
}
private void fillDialog() {
Track track = MyTracksProviderUtils.Factory.get(this).getTrack(trackId);
Track track = MyTracksProviderUtilsFactory.get(this).getTrack(trackId);
if (track != null) {
name.setText(track.getName());
description.setText(track.getDescription());
@@ -103,7 +103,7 @@ public class TrackDetails extends Activity implements OnClickListener {
values.put(TracksColumns.DESCRIPTION, description.getText().toString());
values.put(TracksColumns.CATEGORY, category.getText().toString());
getContentResolver().update(
TracksColumns.CONTENT_URI,
TracksColumns.DATABASE_CONTENT_URI,
values,
"_id = " + trackId,
null/*selectionArgs*/);