Merge 'goog/jb-dev' into 'goog/jb-ub-mail'
Change-Id: I29ca31c2ec3b773a484e8c3b3880057852479125
This commit is contained in:
commit
6a7d10e1c3
|
@ -31,6 +31,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS"/>
|
||||
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
<uses-permission android:name="android.permission.READ_CALENDAR"/>
|
||||
<uses-permission android:name="android.permission.READ_PROFILE"/>
|
||||
<uses-permission android:name="android.permission.NFC"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
|
@ -117,6 +118,23 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activity.EventViewer"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme.Holo.Light"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category
|
||||
android:name="android.intent.category.DEFAULT" />
|
||||
<data
|
||||
android:scheme="content"
|
||||
android:host="ui.email2.android.com"
|
||||
android:pathPrefix="/event"
|
||||
/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- TODO: this activity doesn't exist. Determine what to do here -->
|
||||
<activity android:name=".ui.CreateShortcutActivity"
|
||||
android:label="@string/activity_folder_selection" />
|
||||
|
|
|
@ -16,14 +16,6 @@
|
|||
|
||||
package com.android.emailcommon.internet;
|
||||
|
||||
import com.android.emailcommon.mail.Address;
|
||||
import com.android.emailcommon.mail.MessagingException;
|
||||
import com.android.emailcommon.provider.EmailContent.Attachment;
|
||||
import com.android.emailcommon.provider.EmailContent.Body;
|
||||
import com.android.emailcommon.provider.EmailContent.Message;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
@ -33,6 +25,14 @@ import android.text.TextUtils;
|
|||
import android.util.Base64;
|
||||
import android.util.Base64OutputStream;
|
||||
|
||||
import com.android.emailcommon.mail.Address;
|
||||
import com.android.emailcommon.mail.MessagingException;
|
||||
import com.android.emailcommon.provider.EmailContent.Attachment;
|
||||
import com.android.emailcommon.provider.EmailContent.Body;
|
||||
import com.android.emailcommon.provider.EmailContent.Message;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
|
|
@ -269,6 +269,8 @@ public abstract class EmailContent {
|
|||
public static final String SOURCE_MESSAGE_KEY = "sourceMessageKey";
|
||||
// The text to be placed between a reply/forward response and the original message
|
||||
public static final String INTRO_TEXT = "introText";
|
||||
// The start of quoted text within our text content
|
||||
public static final String QUOTED_TEXT_START_POS = "quotedTextStartPos";
|
||||
}
|
||||
|
||||
public static final class Body extends EmailContent implements BodyColumns {
|
||||
|
@ -285,10 +287,12 @@ public abstract class EmailContent {
|
|||
public static final int CONTENT_TEXT_REPLY_COLUMN = 5;
|
||||
public static final int CONTENT_SOURCE_KEY_COLUMN = 6;
|
||||
public static final int CONTENT_INTRO_TEXT_COLUMN = 7;
|
||||
public static final int CONTENT_QUOTED_TEXT_START_POS_COLUMN = 8;
|
||||
|
||||
public static final String[] CONTENT_PROJECTION = new String[] {
|
||||
RECORD_ID, BodyColumns.MESSAGE_KEY, BodyColumns.HTML_CONTENT, BodyColumns.TEXT_CONTENT,
|
||||
BodyColumns.HTML_REPLY, BodyColumns.TEXT_REPLY, BodyColumns.SOURCE_MESSAGE_KEY,
|
||||
BodyColumns.INTRO_TEXT
|
||||
BodyColumns.INTRO_TEXT, BodyColumns.QUOTED_TEXT_START_POS
|
||||
};
|
||||
|
||||
public static final String[] COMMON_PROJECTION_TEXT = new String[] {
|
||||
|
@ -319,6 +323,7 @@ public abstract class EmailContent {
|
|||
public String mTextContent;
|
||||
public String mHtmlReply;
|
||||
public String mTextReply;
|
||||
public int mQuotedTextStartPos;
|
||||
|
||||
/**
|
||||
* Points to the ID of the message being replied to or forwarded. Will always be set,
|
||||
|
@ -462,6 +467,7 @@ public abstract class EmailContent {
|
|||
mTextReply = cursor.getString(CONTENT_TEXT_REPLY_COLUMN);
|
||||
mSourceKey = cursor.getLong(CONTENT_SOURCE_KEY_COLUMN);
|
||||
mIntroText = cursor.getString(CONTENT_INTRO_TEXT_COLUMN);
|
||||
mQuotedTextStartPos = cursor.getInt(CONTENT_QUOTED_TEXT_START_POS_COLUMN);
|
||||
}
|
||||
|
||||
public boolean update() {
|
||||
|
@ -732,6 +738,7 @@ public abstract class EmailContent {
|
|||
transient public long mSourceKey;
|
||||
transient public ArrayList<Attachment> mAttachments = null;
|
||||
transient public String mIntroText;
|
||||
transient public int mQuotedTextStartPos;
|
||||
|
||||
|
||||
// Values used in mFlagRead
|
||||
|
@ -968,6 +975,9 @@ public abstract class EmailContent {
|
|||
if (mIntroText != null) {
|
||||
cv.put(Body.INTRO_TEXT, mIntroText);
|
||||
}
|
||||
if (mQuotedTextStartPos != 0) {
|
||||
cv.put(Body.QUOTED_TEXT_START_POS, mQuotedTextStartPos);
|
||||
}
|
||||
b = ContentProviderOperation.newInsert(Body.CONTENT_URI);
|
||||
// Put our message id in the Body
|
||||
if (!isNew) {
|
||||
|
|
|
@ -75,18 +75,6 @@ public final class ActivityHelper {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Calendar app with specific time
|
||||
*/
|
||||
public static void openCalendar(Activity activity, long epochEventStartTime) {
|
||||
Uri uri = Uri.parse("content://com.android.calendar/time/" + epochEventStartTime);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(uri);
|
||||
intent.putExtra("VIEW", "DAY");
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
/**
|
||||
* If configured via debug flags, inhibit hardware graphics acceleration. Must be called
|
||||
* early in onCreate().
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.email.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.CalendarContract;
|
||||
|
||||
import com.android.emailcommon.mail.MeetingInfo;
|
||||
import com.android.emailcommon.mail.PackedString;
|
||||
import com.android.emailcommon.provider.EmailContent.Message;
|
||||
import com.android.emailcommon.utility.Utility;
|
||||
|
||||
public class EventViewer extends Activity {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
Uri uri = getIntent().getData();
|
||||
long messageId = Long.parseLong(uri.getLastPathSegment());
|
||||
Message msg = Message.restoreMessageWithId(this, messageId);
|
||||
if (msg == null) {
|
||||
finish();
|
||||
} else {
|
||||
PackedString info = new PackedString(msg.mMeetingInfo);
|
||||
String uid = info.get(MeetingInfo.MEETING_UID);
|
||||
long eventId = -1;
|
||||
if (uid != null) {
|
||||
Cursor c = getContentResolver().query(CalendarContract.Events.CONTENT_URI,
|
||||
new String[] {CalendarContract.Events._ID},
|
||||
CalendarContract.Events.SYNC_DATA2 + "=?",
|
||||
new String[] {uid}, null);
|
||||
if (c != null) {
|
||||
try {
|
||||
if (c.getCount() == 1) {
|
||||
c.moveToFirst();
|
||||
eventId = c.getLong(0);
|
||||
}
|
||||
} finally {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
if (eventId != -1) {
|
||||
uri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, eventId);
|
||||
} else {
|
||||
long time =
|
||||
Utility.parseEmailDateTimeToMillis(info.get(MeetingInfo.MEETING_DTSTART));
|
||||
uri = Uri.parse("content://com.android.calendar/time/" + time);
|
||||
intent.putExtra("VIEW", "DAY");
|
||||
}
|
||||
intent.setData(uri);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -131,7 +131,8 @@ public final class DBHelper {
|
|||
// Version 4: Database wipe required; changing AccountManager interface w/Exchange
|
||||
// Version 5: Database wipe required; changing AccountManager interface w/Exchange
|
||||
// Version 6: Adding Body.mIntroText column
|
||||
public static final int BODY_DATABASE_VERSION = 6;
|
||||
// Version 7: Adding quoted text start pos
|
||||
public static final int BODY_DATABASE_VERSION = 8;
|
||||
|
||||
/*
|
||||
* Internal helper method for index creation.
|
||||
|
@ -467,7 +468,8 @@ public final class DBHelper {
|
|||
+ BodyColumns.HTML_REPLY + " text, "
|
||||
+ BodyColumns.TEXT_REPLY + " text, "
|
||||
+ BodyColumns.SOURCE_MESSAGE_KEY + " text, "
|
||||
+ BodyColumns.INTRO_TEXT + " text"
|
||||
+ BodyColumns.INTRO_TEXT + " text, "
|
||||
+ BodyColumns.QUOTED_TEXT_START_POS + " integer"
|
||||
+ ");";
|
||||
db.execSQL("create table " + Body.TABLE_NAME + s);
|
||||
db.execSQL(createIndex(Body.TABLE_NAME, BodyColumns.MESSAGE_KEY));
|
||||
|
@ -478,9 +480,11 @@ public final class DBHelper {
|
|||
try {
|
||||
db.execSQL("drop table " + Body.TABLE_NAME);
|
||||
createBodyTable(db);
|
||||
oldVersion = 5;
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
} else if (oldVersion == 5) {
|
||||
}
|
||||
if (oldVersion == 5) {
|
||||
try {
|
||||
db.execSQL("alter table " + Body.TABLE_NAME
|
||||
+ " add " + BodyColumns.INTRO_TEXT + " text");
|
||||
|
@ -490,6 +494,16 @@ public final class DBHelper {
|
|||
}
|
||||
oldVersion = 6;
|
||||
}
|
||||
if (oldVersion == 6 || oldVersion ==7) {
|
||||
try {
|
||||
db.execSQL("alter table " + Body.TABLE_NAME
|
||||
+ " add " + BodyColumns.QUOTED_TEXT_START_POS + " integer");
|
||||
} catch (SQLException e) {
|
||||
// Shouldn't be needed unless we're debugging and interrupt the process
|
||||
Log.w(TAG, "Exception upgrading EmailProviderBody.db from v6 to v8", e);
|
||||
}
|
||||
oldVersion = 8;
|
||||
}
|
||||
}
|
||||
|
||||
protected static class BodyDatabaseHelper extends SQLiteOpenHelper {
|
||||
|
|
|
@ -2289,6 +2289,10 @@ outer:
|
|||
com.android.mail.providers.Attachment.toJSONArray(uiAtts));
|
||||
}
|
||||
}
|
||||
if ((msg.mFlags & Message.FLAG_INCOMING_MEETING_INVITE) != 0) {
|
||||
values.put(UIProvider.MessageColumns.EVENT_INTENT_URI,
|
||||
"content://ui.email2.android.com/event/" + msg.mId);
|
||||
}
|
||||
StringBuilder sb = genSelect(sMessageViewMap, uiProjection, values);
|
||||
sb.append(" FROM " + Message.TABLE_NAME + "," + Body.TABLE_NAME + " WHERE " +
|
||||
Body.MESSAGE_KEY + "=" + Message.TABLE_NAME + "." + Message.RECORD_ID + " AND " +
|
||||
|
@ -3039,6 +3043,7 @@ outer:
|
|||
msg.mDisplayName = msg.mTo;
|
||||
msg.mFlagLoaded = Message.FLAG_LOADED_COMPLETE;
|
||||
msg.mFlagRead = true;
|
||||
msg.mQuotedTextStartPos = values.getAsInteger(UIProvider.MessageColumns.QUOTE_START_POS);
|
||||
int flags = 0;
|
||||
int draftType = values.getAsInteger(UIProvider.MessageColumns.DRAFT_TYPE);
|
||||
switch(draftType) {
|
||||
|
|
Loading…
Reference in New Issue