When brakes are applied, the acceleration along the direction of motion will reverse sign. For example, if you position your phone such that the z-axis of the accelerator is in the direction of gravity axis(i.e. facing earth), then the acceleration along z-axis is -g. One the other hand if the negative z-axis is aligned with g, then z-axis of accelerometer measures +g. This is analogous to the scenario of a car accelerating and braking, although magnitude of deceleration is a little lower than acceleration. You can start by defining the reference axis as the g-axis and defining the other 2 axes based on direction of least and maximum acceleration, using a rotation matrix. You basically change the reference axis from x,y,z co-ordinates which is based on orientation of the phone to an stationary g,a,s reference system (where g is gravity axis, a is direction of maximum acceleration and s stationary axis). You can also use a gyroscope to achieve this axis rotation as discussed in this page. One you are able to view to the accelerometer daya in the transformed axes, you can easily classify regions of acceleration and deceleration based on signal from just one axis regardless of the orientation of the phone by looking for zero crossings.