Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
Fix bugs in Mms Appwidget
Browse files Browse the repository at this point in the history
1. Need to use PendingIntent instead to set the click listener for "View
more conversations"
2. No need to lock sWidgetLock in getConversationCount(), since it was already
locked outside.

Change-Id: Ifacbbcb720c8b7126f93fbbc2cbe862e0b6558a6
Signed-off-by: Roger Chen <cxr514033970@gmail.com>
  • Loading branch information
cxr514033970 committed Nov 15, 2012
1 parent 8f33ff2 commit 1c55966
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/com/android/mms/widget/MmsWidgetService.java
Expand Up @@ -16,6 +16,7 @@

package com.android.mms.widget;

import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
Expand Down Expand Up @@ -183,9 +184,8 @@ private int getConversationCount() {
if (Log.isLoggable(LogTag.WIDGET, Log.VERBOSE)) {
Log.v(TAG, "getConversationCount");
}
synchronized (sWidgetLock) {
return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
}

return Math.min(mConversationCursor.getCount(), MAX_CONVERSATIONS_COUNT);
}

/*
Expand Down Expand Up @@ -301,8 +301,11 @@ private RemoteViews getViewMoreConversationsView() {
RemoteViews view = new RemoteViews(mContext.getPackageName(), R.layout.widget_loading);
view.setTextViewText(
R.id.loading_text, mContext.getText(R.string.view_more_conversations));
view.setOnClickFillInIntent(R.id.widget_loading,
new Intent(mContext, ConversationList.class));
PendingIntent pendingIntent =
PendingIntent.getActivity(mContext, 0, new Intent(mContext,
ConversationList.class),
PendingIntent.FLAG_UPDATE_CURRENT);
view.setOnClickPendingIntent(R.id.widget_loading, pendingIntent);
return view;
}

Expand Down

0 comments on commit 1c55966

Please sign in to comment.