Many reasons are being given by the experts including firing by Pak is to give cover to infiltration, this is being done to bring Kashmir to International fora, etc. All of them are plausible individually and collectively.
However, to me, it appears to be a collusion between China and Pak to deliberately keep india guessing and confused The incursions by China without any provocation and the cease fire violations by Pak are all part of attempts to keep india unstable.
Why do they want India to be unstable? There is new NDA government at center with a clear focus on economy and governance. It they win in Maharashtra and Haryana (as of now it is difficult to predict) they will become further powerful. Their numbers in Rajya Sabha will also become better.
This will further strengthen the resolve of the government to go full steam ahead with its agenda. It is also determined to improve relations with immediate neighbors (baring incorrigible Pak) and others (Japan, Australia, USA, Vietnam, etc).
Focus on economy and governance will turn around this nation and make it even more strong economically. Better economy also automatically makes more money available for defence even when GDP % share of defence in the budget may remain unchanged. Better relations with other nations will make China worried (almost all these governments are inimical to China).
How can China stop this? by incursions themselves and by its proxy Pak indulging in cease fire violations. The government should show both of them that this government has no compulsion of collation and is capable of taking firm stand. Some people arguse that we should not have responded to antics of Pak, may be. But will Pak get tired and stop firing if we don't respond? Unlikely. Pak will only stop when the cost of this adventure becomes prohibitive for them (as stated by our defence minister).
Government should leave the job of containing these two actors to security establishment (with laying down clear policies for them to follow) and balance government machinery must focus on its main task, Economical revival and governance.
This two prong strategy may be the only answer to these two countries.