Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e014a18 authored by Hemant Gupta's avatar Hemant Gupta Committed by Andre Eisenbach
Browse files

OPP: Clear Ongoing Notification after transfer complete.

Use Case:
1.Push any file from BM3 dongle to DUT.
2.Accept it on DUT and let the transfer begin.

Error:
Drag down the notification bar and notice that even after
the file is transferred, progress is stuck at 99%.

Root cause:
In Android O clearing of ongoing notification is done on reception of
disconnect from remote. Since BM3 as remote device does not disconnect the
OPP connection, progress bar is stuck at 99%.

Fix:
Clear ongoing notification after file sent successfully without waiting
disconnect request to prevent abnormal UI behaviour.

Test: Issue is not reproducible after stress testing with above change.
Bug: 68832852
Change-Id: Ic514af19de1d554f9299c5daf74fc0d046a67009
parent 0e535fa8
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@

package com.android.bluetooth.opp;

import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
@@ -113,10 +112,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                }
            }
        }
        NotificationManager nm =
                (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
        nm.cancel(BluetoothOppNotification.NOTIFICATION_ID_PROGRESS);

        BluetoothOppUtility.cancelNotification(mContext);
        mCallback = null;
    }

@@ -610,6 +606,7 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                    }
                }
            }
            BluetoothOppUtility.cancelNotification(mContext);
            return status;
        }

+2 −6
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@

package com.android.bluetooth.opp;

import android.app.NotificationManager;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@@ -567,6 +566,7 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler
                Log.e(TAG, "Error when closing stream after send");
            }
        }
        BluetoothOppUtility.cancelNotification(mContext);
        return status;
    }

@@ -660,11 +660,7 @@ public class BluetoothOppObexServerSession extends ServerRequestHandler
            }
            mServerSocket.prepareForNewConnect();
        }

        NotificationManager nm =
                (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
        nm.cancel(BluetoothOppNotification.NOTIFICATION_ID_PROGRESS);

        BluetoothOppUtility.cancelNotification(mContext);
        /* onClose could happen even before start() where mCallback is set */
        if (mCallback != null) {
            Message msg = Message.obtain(mCallback);
+8 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@

package com.android.bluetooth.opp;

import android.app.NotificationManager;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ActivityNotFoundException;
@@ -410,4 +411,11 @@ public class BluetoothOppUtility {
            return false;
        }
    }

    protected static void cancelNotification(Context ctx) {
        NotificationManager nm = (NotificationManager) ctx
                .getSystemService(Context.NOTIFICATION_SERVICE);
        nm.cancel(BluetoothOppNotification.NOTIFICATION_ID_PROGRESS);
    }

}