Suppose that I have a sequence of size $n$: $x_1,\ldots,x_n$, $x_i\in\{0,1\}$. My null hypothesis is that all $n$ members of the sequence are drawn independently from an identical Bernoulli distribution with $P(x_i=1)=p$. My alternate hypothesis is that the $j$-th subsequence of length $m$ is drawn independently from an identical Bernoulli distribution with $P(x_i=1)=p_j$ for $(j-1)m<i\leq jm$, $1\leq j \leq n/m$ such that there exists $p_{\mathcal{X}}$ which partitions the set of subsequences; that is, letting $\mathcal{X}=\{j: p_j<p_{\mathcal{X}}\}$, $|\mathcal{X}|=\gamma n$ with $\gamma\in(0,1)$ a test parameter. We assume that the draws are independent across subsequences.
The fact that the sums of the subsequences $s_j=\sum_{i=(j-1)m+1}^{jm}x_i$ are drawn from binomial distribution yields the following alternative statement of the hypotheses:
$$H_0: s_j\sim \text{Binomial}(p,m), 1\leq j \leq n/m\\ H_1:s_j\sim \text{Binomial}(p_j,m)~\text{and there exists}~p_{\mathcal{X}}~\text{such that}~\mathcal{X}=\{j: p_j<p_{\mathcal{X}}\}, |\mathcal{X}|=\gamma n$$
Is there a statistical test between these two hypotheses given a parameter $\gamma$? We know $n$ to be very large, order of hundreds of millions, $m$ is also large, order of tens of thousands, $p$ and $p_j$'s are unknown, but small (order of $10^{-4}$ so zeros are prevalent). Any suggestions?