Habeas is a Hail Mary pass. In order to give the federal district court jurisdiction to hear the petition, the trial court, and state appellate court must have arrived at a decision contrary to federal law. Then the prisoner must exhaust his state habeas remedies before the federal court will grant collateral review. After all that, if there is still a constitutionally deficient mistake, the Federal judge will grant the petition and compel relief. The vast majority (perhaps 99%) of these petitions fail, but if you had a 1% chance of getting out of prison and no negative consequence for filing, wouldn't you take it?
Alvarez v. McDonald is a petition for habeas corpus on both grounds listed above. A jury in Santa Clara County convicted the petitioner of raping a woman in front of her children and the trial judge sentenced him to forty-three years in prison. He now complains that character evidence of his propensity to commit the offense was improperly admitted because several witnesses testified that he beat and raped them in a similar manner. The U.S. Supreme Court has expressly evaded the question of whether such evidence violates due process:
Because we need not reach the issue, we express no opinion on whether a state law would violate the Due Process Clause if it permitted the use of "prior crimes" evidence to show propensity to commit a charged crime.Estelle v. McGuire (U.S. 1991). Therefore the admission of the evidence was not contrary to the Constitution and Judge William H. Alsup denied the petition.
Hughes v. Runnels is a petition for habeas corpus involving a bank robber sentenced to 155 years to life. Among other things, the petitioner complains about a sentence enhancement for shooting a gun at a fleeing police officer. This invokes Apprendi v. New Jersey (U.S. 2000):
Petitioner also contends that the jury instructions led to an Apprendi error. The Sixth Amendment requires that "[o]ther than the fact of a prior conviction,  any fact that  increases the penalty for a crime  beyond the prescribed statutory maximum  must be submitted to a jury, and  proved beyond a reasonable doubt.” [Apprendi]. Petitioner’s claim is unavailing because the charges and enhancements were submitted to the jury, which found petitioner guilty beyond a reasonable doubt and that the sentencing enhancements were true.Therefore, Judge Alsup denied this petition as well.