A lawsuit filed by an LAPD captain offers a revealing look at the behind-the-scenes coordination — and friction — between police officials and the city attorney’s office.